通勤認定エクセルツール対応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

@@ -218,6 +218,77 @@ Public Sub BuildRenrakuDropdown(ws As Worksheet, ByVal columnLetter As String, B
End With
End Sub
' ============================================================
' Z4 Rosen Dropdown Builders for M1 E/F/H cascade
' ============================================================
' Build F column (station from) dropdown based on E column (rosen name)
Public Sub BuildZ4StationFromDropdown(ws As Worksheet, ByVal columnLetter As String, ByVal rowNum As Long, ByVal rosen As String)
Dim z4RosenCache As Object: Set z4RosenCache = GetCache(CACHE_Z4ROSEN)
ws.Range(columnLetter & rowNum).Validation.Delete
If rosen = "" Then Exit Sub
If Not z4RosenCache.Exists(rosen) Then Exit Sub
Dim stationFromDict As Object: Set stationFromDict = z4RosenCache(rosen)
Dim dropdownList As String: dropdownList = ""
Dim stationFrom As Variant
For Each stationFrom In stationFromDict.Keys
If dropdownList = "" Then
dropdownList = stationFrom
Else
dropdownList = dropdownList & "," & stationFrom
End If
Next stationFrom
If dropdownList = "" Then Exit Sub
With ws.Range(columnLetter & rowNum).Validation
.Delete
.Add Type:=xlValidateList, Formula1:=dropdownList
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.InputMessage = ""
End With
End Sub
' Build H column (station to) dropdown based on E column (rosen name) and F column (station from)
Public Sub BuildZ4StationToDropdown(ws As Worksheet, ByVal columnLetter As String, ByVal rowNum As Long, ByVal rosen As String, ByVal stationFrom As String)
Dim z4RosenCache As Object: Set z4RosenCache = GetCache(CACHE_Z4ROSEN)
ws.Range(columnLetter & rowNum).Validation.Delete
If rosen = "" Or stationFrom = "" Then Exit Sub
If Not z4RosenCache.Exists(rosen) Then Exit Sub
Dim stationFromDict As Object: Set stationFromDict = z4RosenCache(rosen)
If Not stationFromDict.Exists(stationFrom) Then Exit Sub
Dim stationToDict As Object: Set stationToDict = stationFromDict(stationFrom)
Dim dropdownList As String: dropdownList = ""
Dim stationTo As Variant
For Each stationTo In stationToDict.Keys
If dropdownList = "" Then
dropdownList = stationTo
Else
dropdownList = dropdownList & "," & stationTo
End If
Next stationTo
If dropdownList = "" Then Exit Sub
With ws.Range(columnLetter & rowNum).Validation
.Delete
.Add Type:=xlValidateList, Formula1:=dropdownList
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.InputMessage = ""
End With
End Sub
' Create display dropdown
Public Sub BuildDisplayDropdown(ws As Worksheet, ByVal rowNum As Long)
' validate sheet