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) ' Button macro (Validate selected row)
Sub validateDetailDataButton() Sub validateDetailDataButton()
Dim rowNum As Long Dim ws As Worksheet
rowNum = ActiveCell.Row Dim lastRow As Long
Dim r As Long
Dim errorCount As Long
If rowNum < 7 Then Set ws = ActiveSheet
MsgBox "データ行を選択してください。", vbExclamation lastRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
If lastRow < 7 Then
MsgBox "データがありません。", vbExclamation
Exit Sub Exit Sub
End If 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 End Sub
Sub ExportMasterDetailData() Sub ExportMasterDetailData()