通勤認定エクセルツール対応12 M1 対応

This commit is contained in:
guanxiangwei
2026-05-28 12:58:08 +09:00
parent df9cd0a7ad
commit 50ef0c74cc
14 changed files with 602 additions and 199 deletions

View File

@@ -13,6 +13,38 @@ Private Sub Worksheet_Change(ByVal Target As Range)
Dim HasHeaderEdit As Boolean: HasHeaderEdit = CheckHeaderEdit(Me, Target)
If HasHeaderEdit = True Then Exit Sub
Application.EnableEvents = False
On Error GoTo Finally
' === Column C changes: Create D column dropdown ===
If Target.Column = 3 And Target.Row >= 7 Then
Dim cell As Range
For Each cell In Target
If Trim(cell.Value) = "" Then
Call ClearDataRow(Me, cell.Row)
Else
Call BuildDisplayDropdown(Me, cell.Row)
End If
Next
End If
' === Column G changes: Fill E column ===
If Target.Column = 7 And Target.Row >= 7 Then
Dim cellG As Range
For Each cellG In Target
Dim displayValue As String: displayValue = Trim(cellG.Value)
If displayValue <> "" Then
cellG.Value = GetCode(displayValue)
End If
Next
End If
Application.EnableEvents = True
Exit Sub
Finally:
HandleError "Worksheet_Change"
Application.EnableEvents = True
End Sub
' Prevent insert/delete row in header area
@@ -38,10 +70,12 @@ Public Sub Validate(ws As Worksheet, ByVal rowNum As Long, ByVal lastDataRow As
Dim endCol As String: endCol = sheetConf("EndCol")
Dim errorCol As String: errorCol = sheetConf("ErrorCol")
' clear C~I columns background color
' clear C~G 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
@@ -79,4 +113,4 @@ Public Sub Validate(ws As Worksheet, ByVal rowNum As Long, ByVal lastDataRow As
ErrHandler:
lastErrorMsg = Err.Description
End Sub
End Sub