Validate all data rows on button click

This commit is contained in:
updsv7
2026-04-13 11:37:02 +09:00
parent 64139ae32c
commit 105517408f

View File

@@ -348,15 +348,28 @@ End Sub
' Button macro (Validate selected row)
Sub validateDetailDataButton()
Dim rowNum As Long
rowNum = ActiveCell.Row
Dim ws As Worksheet
Dim lastRow As Long
Dim r As Long
Dim errorCount As Long
If rowNum < 7 Then
MsgBox "データ行を選択してください。", vbExclamation
Set ws = ActiveSheet
lastRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
If lastRow < 7 Then
MsgBox "データがありません。", vbExclamation
Exit Sub
End If
Call validateDetailData(ActiveSheet, rowNum)
errorCount = 0
For r = 7 To lastRow
Call validateDetailData(ws, r)
If Trim(ws.Cells(r, 17).Value) <> "" Then
errorCount = errorCount + 1
End If
Next r
MsgBox "検証完了。エラー: " & errorCount & " 件", vbInformation
End Sub
Sub ExportMasterDetailData()