通勤認定エクセルツール対応14
This commit is contained in:
@@ -63,58 +63,25 @@ End Sub
|
||||
Public Sub Validate(ws As Worksheet, ByVal rowNum As Long, ByVal lastDataRow As Long)
|
||||
On Error GoTo ErrHandler
|
||||
|
||||
Dim sheetConfDict As Object: Set sheetConfDict = GetSheetConfig()
|
||||
Dim sheetConf As Object: Set sheetConf = sheetConfDict(ws.CodeName)
|
||||
Dim engine As ValidationRuleEngine: Set engine = New ValidationRuleEngine
|
||||
With engine
|
||||
.AddRequired "C"
|
||||
.AddChar "C", 6
|
||||
.AddAlphanumeric "C"
|
||||
.AddDuplicate "C"
|
||||
.AddRequired "D"
|
||||
.AddVarchar "D", 80
|
||||
.AddVarchar "E", 80
|
||||
.AddRequired "F"
|
||||
.AddVarchar "F", 80
|
||||
.AddVarchar "G", 80
|
||||
.AddCheck01 "H"
|
||||
End With
|
||||
|
||||
Dim startCol As String: startCol = sheetConf("StartCol")
|
||||
Dim endCol As String: endCol = sheetConf("EndCol")
|
||||
Dim errorCol As String: errorCol = sheetConf("ErrorCol")
|
||||
Call engine.ValidateRow(ws, rowNum, lastDataRow)
|
||||
|
||||
' clear C~H columns background color
|
||||
Dim clearRange As Range: Set clearRange = ws.Range(ws.Cells(rowNum, startCol), ws.Cells(rowNum, endCol))
|
||||
clearRange.Interior.Color = vbWhite
|
||||
|
||||
Dim checkResult As Boolean: checkResult = False
|
||||
|
||||
' C column check
|
||||
checkResult = CheckRequired(ws, rowNum, 3, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
checkResult = CheckChar(ws, rowNum, 3, 6, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
checkResult = CheckAlphanumeric(ws, rowNum, 3, 6, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
checkResult = CheckDuplicate(ws, rowNum, 3, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
' D column check
|
||||
checkResult = CheckRequired(ws, rowNum, 4, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
checkResult = CheckVarcharOver(ws, rowNum, 4, 80, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
' E column check
|
||||
checkResult = CheckVarcharOver(ws, rowNum, 5, 80, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
' F column check
|
||||
checkResult = CheckVarcharOver(ws, rowNum, 6, 80, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
' G column check
|
||||
checkResult = CheckVarcharOver(ws, rowNum, 7, 80, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
' H column check
|
||||
checkResult = Check01(ws, rowNum, 8, errorCol)
|
||||
If checkResult = False Then Exit Sub
|
||||
|
||||
ws.Cells(rowNum, errorCol).ClearContents
|
||||
Exit Sub
|
||||
|
||||
ErrHandler:
|
||||
lastErrorMsg = Err.Description
|
||||
SetLastErrorMsg Err.Description
|
||||
End Sub
|
||||
Reference in New Issue
Block a user