20260515指摘対応4

This commit is contained in:
guanxiangwei
2026-05-18 12:24:18 +09:00
parent 553148202c
commit b359ae916b
5 changed files with 94 additions and 63 deletions

View File

@@ -1,21 +1,24 @@
Attribute VB_Name = "Common_Selector"
Option Explicit
' ============================================================
' Module Name: Build_Select
' Module Desc: Commuter allowance editing sheet (no CSV import)
' Module Name: Common_Selector
' Module Desc: Build dropdown lists from cache data
' Module Methods:
' - Tukin_ValidateRow
' - FillTransportFromM1KukanD
' - FillDepartureFromM1KukanD
' - FillArrivalFromM1KukanD
' - FillKukanFromM1
' - FillKanshuFromM2
' - FillCodeFromM2
' - FillAddressFromO1
' - FillZ1Dropdown
' - BuildTransportList
' - BuildTodokeList
' - BuildOufukuList
' - BuildKoutaiList
' - BuildKetteiList
' - BuildHigaitouList
' - BuildMonthAmountKbnList
' - BuildKanshokuList
' - BuildKenshuList
' ============================================================
' Create transport (T) dropdown from Z1 cache
' ============================================================
' Event Handlers
' ============================================================
' Create Transport (T) dropdown from Z1 cache
Public Function BuildTransportList()
Dim z1Cache As Object: Set z1Cache = GetCache("Z1")
@@ -34,7 +37,7 @@ Public Function BuildTransportList()
BuildTransportList = dropdownList
End Function
' Create todoke (G) dropdown
' Create Todoke (G) dropdown
Public Function BuildTodokeList()
Dim z4Cache As Object: Set z4Cache = GetCache("Z4")
@@ -52,7 +55,7 @@ Public Function BuildTodokeList()
BuildTodokeList = dropdownList
End Function
' Create oufuku (M) dropdown
' Create Oufuku (M) dropdown
Public Function BuildOufukuList()
Dim oufukuList As Object: Set oufukuList = GetCache("oufukuList")
@@ -159,3 +162,54 @@ Public Function BuildKanshokuList()
Next key
BuildKanshokuList = dropdownList
End Function
' Create Kenshu dropdown (exclude key = 0)
Public Sub BuildKenshuDropdown(ws As Worksheet, ByVal columnLetter As String, ByVal rowNum As Long)
Dim kenshuList As Object: Set kenshuList = GetCache("kenshuList")
Dim dropdownList As String
Dim key As Variant
For Each key In kenshuList.Keys
If key <> 0 Then
Dim displayText As String
displayText = MakeSelect(key, kenshuList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
End If
Next key
With ws.Range(columnLetter & rowNum).Validation
.Delete
.Add Type:=xlValidateList, Formula1:=dropdownList
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.InputMessage = ""
End With
End Sub
' Create Kenshu dropdown (exclude key = 0)
Public Sub BuildTokubetuDropdown(ws As Worksheet, ByVal columnLetter As String, ByVal rowNum As Long)
Dim tokubetuList As Object: Set tokubetuList = GetCache("tokubetuList")
Dim dropdownList As String: dropdownList = ""
Dim key As Variant
For Each key In tokubetuList.Keys
If dropdownList = "" Then
dropdownList = key
Else
dropdownList = dropdownList & "," & key
End If
Next key
With ws.Range(columnLetter & rowNum).Validation
.Delete
.Add Type:=xlValidateList, Formula1:=dropdownList
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.InputMessage = ""
End With
End Sub