update Generic Master bas5

This commit is contained in:
updsv7
2026-04-15 15:16:14 +09:00
parent 5e906f3300
commit 63d09d78a7
6 changed files with 339 additions and 247 deletions

View File

@@ -1,4 +1,10 @@
' ====== (223) =======
' ====== Constants ======
Const START_COL As Long = 3
Const END_COL As Long = 7
' ====== Function ======
Sub Z2_ClearRowData(ByVal ws As Worksheet, ByVal rowNum As Long)
Call Generic_Master_ClearRowData(ws, rowNum)
End Sub
@@ -8,15 +14,14 @@ Sub Z2_Import()
End Sub
Sub Z2_Export()
Dim lastDataRow As Long: lastDataRow = GetLastDataRow(Me, 3)
Dim lastDataRow As Long: lastDataRow = GetLastDataRowInRange(Me, START_COL, END_COL)
If lastDataRow < 7 Then
MsgBox "No data rows to output.", vbExclamation
Exit Sub
End If
Dim r As Long
Dim errorCount As Long
Dim r As Long, errorCount As Long
For r = 7 To lastDataRow
Validate r
If Trim(Cells(r, 2).Value & "") <> "" Then
@@ -33,14 +38,12 @@ Sub Z2_Export()
End Sub
Sub Validate(ByVal rowNum As Long)
Dim cValue As String
Set ws = Me
cValue = Trim(ws.Cells(rowNum, 3).Value)
Dim cValue As String: cValue = Trim(ws.Cells(rowNum, 3).Value)
' clear C~I columns background color
Dim clearRange As Range
Set clearRange = ws.Range(ws.Cells(rowNum, 3), ws.Cells(rowNum, 7))
Set clearRange = ws.Range(ws.Cells(rowNum, START_COL), ws.Cells(rowNum, END_COL))
clearRange.Interior.Color = vbWhite
If cValue = "" Then
@@ -119,19 +122,16 @@ Sub Validate(ByVal rowNum As Long)
End Sub
Sub Z2_validateButton()
Dim lastRow As Long
Dim r As Long
Dim errorCount As Long
Dim lastDataRow As Long, r As Long, errorCount As Long
lastDataRow = GetLastDataRowInRange(Me, START_COL, END_COL)
lastRow = GetLastDataRow(Me, 3)
If lastRow < 7 Then
If lastDataRow < 7 Then
MsgBox "No data found.", vbExclamation
Exit Sub
End If
errorCount = 0
For r = 7 To lastRow
For r = 7 To lastDataRow
Validate r
If Trim(Cells(r, 2).Value) <> "" Then
errorCount = errorCount + 1
@@ -150,5 +150,5 @@ Sub Z2_ToggleAutoFilter()
End Sub
Sub Z2_AutoFitColumnWidth()
Call AutoFitColumnWidth(2, 7)
Call AutoFitColumnWidth(2, END_COL)
End Sub