update C1

This commit is contained in:
updsv7
2026-04-18 15:00:55 +09:00
parent 54c422d4e9
commit 7c487cba0b
4 changed files with 196 additions and 255 deletions

159
src/module/Build_Select.bas Normal file
View File

@@ -0,0 +1,159 @@
' ============================================================
' Module Name: Build_Select
' Module Desc: Commuter allowance editing sheet (no CSV import)
' Module Methods:
' - Tukin_ValidateRow
' - FillTransportFromM1KukanD
' - FillDepartureFromM1KukanD
' - FillArrivalFromM1KukanD
' - FillKukanFromM1
' - FillKanshuFromM2
' - FillCodeFromM2
' - FillAddressFromO1
' - FillZ1Dropdown
' ============================================================
' Create transport (T) dropdown from Z1 cache
Public Function BuildTransportList()
If z1Cache Is Nothing Then Call RefreshZ1Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z1Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z1Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildTransportList = dropdownList
End Function
' Create todoke (G) dropdown
Public Function BuildTodokeList()
If z4Cache Is Nothing Then Call RefreshZ4Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z4Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z4Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildTodokeList = dropdownList
End Function
' Create oufuku (M) dropdown
Public Function BuildOufukuList()
If oufukuList Is Nothing Then Call GetOufukuList
Dim dropdownList As String
Dim key As Variant
For Each key In oufukuList.Keys
Dim displayText As String
displayText = MakeSelect(key, oufukuList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildOufukuList = dropdownList
End Function
' Create Koutai (N) dropdown
Public Function BuildKoutaiList()
If koutaiList Is Nothing Then Call GetKoutaiList
Dim dropdownList As String
Dim key As Variant
For Each key In koutaiList.Keys
Dim displayText As String
displayText = MakeSelect(key, koutaiList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildKoutaiList = dropdownList
End Function
' Create Kettei (AU) dropdown
Public Function BuildKetteiList()
If z2Cache Is Nothing Then Call RefreshZ2Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z2Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z2Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildKetteiList = dropdownList
End Function
' Create Higaitou (AW) dropdown
Public Function BuildHigaitouList()
If higaitouList Is Nothing Then Call GetHigaitouList
Dim dropdownList As String
Dim key As Variant
For Each key In higaitouList.Keys
Dim displayText As String
displayText = MakeSelect(key, higaitouList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildHigaitouList = dropdownList
End Function
' Create MonthAmountKbn (AX) dropdown
Public Function BuildMonthAmountKbnList()
If z3Cache Is Nothing Then Call RefreshZ3Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z3Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z3Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildMonthAmountKbnList = dropdownList
End Function
' Create Kanshoku (BC) dropdown
Public Function BuildKanshokuList()
If o2Cache Is Nothing Then Call RefreshO2Cache
Dim dropdownList As String
Dim key As Variant
For Each key In o2Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, o2Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildKanshokuList = dropdownList
End Function

View File

@@ -0,0 +1,10 @@
'=============================================================================
'=============================================================================
Option Explicit
'-----------------------------------------------------------------------------
'-----------------------------------------------------------------------------
Public Function IsDateString(ByVal inputStr As String) As Boolean
End Function

View File

@@ -206,117 +206,34 @@ Private Sub RebuildDropdownsForTarget(ByVal Target As Range)
processedRows(r) = True
Dim colLetter As String
colLetter = Split(Me.Cells(1, cell.Column).Address(True, False), "$")(0) ' obtain column
colLetter = Split(Me.Cells(1, cell.Column).Address(True, False), "$")(0)
' --- T: Transport ---
If colLetter <> "T" Then
With Me.Cells(r, "T").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildTransportList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
Dim dropdowns As Variant
dropdowns = Array( _
Array("T", "BuildTransportList"), _
Array("AA", "BuildTransportList"), _
Array("AH", "BuildTransportList"), _
Array("AO", "BuildTransportList"), _
Array("G", "BuildTodokeList"), _
Array("M", "BuildOufukuList"), _
Array("N", "BuildKoutaiList"), _
Array("AU", "BuildKetteiList"), _
Array("AW", "BuildHigaitouList"), _
Array("AX", "BuildMonthAmountKbnList"), _
Array("BC", "BuildKanshokuList") _
)
' --- AA: Transport ---
If colLetter <> "AA" Then
With Me.Cells(r, "AA").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildTransportList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- AH: Transport ---
If colLetter <> "AH" Then
With Me.Cells(r, "AH").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildTransportList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- AO: Transport ---
If colLetter <> "AO" Then
With Me.Cells(r, "AO").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildTransportList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- G: todoke ---
If colLetter <> "G" Then
With Me.Cells(r, "G").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildTodokeList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- M: oufuku ---
If colLetter <> "M" Then
With Me.Cells(r, "M").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildOufukuList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- N: koutai ---
If colLetter <> "N" Then
With Me.Cells(r, "N").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildKoutaiList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- AU: kettei ---
If colLetter <> "AU" Then
With Me.Cells(r, "AU").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildKetteiList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- AW: higaitou ---
If colLetter <> "AW" Then
With Me.Cells(r, "AW").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildHigaitouList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- AX: monthAmountKbn ---
If colLetter <> "AX" Then
With Me.Cells(r, "AX").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildMonthAmountKbnList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
' --- BC: kanshoku ---
If colLetter <> "BC" Then
With Me.Cells(r, "BC").Validation
.Delete
.Add Type:=xlValidateList, Formula1:=BuildKanshokuList()
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
Dim i As Long
For i = LBound(dropdowns) To UBound(dropdowns)
If colLetter <> dropdowns(i)(0) Then
With Me.Cells(r, dropdowns(i)(0)).Validation
.Delete
.Add Type:=xlValidateList, Formula1:=Application.Run(dropdowns(i)(1))
.IgnoreBlank = True
.InCellDropdown = True
End With
End If
Next i
End If
NextCell:
@@ -392,151 +309,6 @@ Private Sub FillAddressFromO1(ByVal rowNum As Long)
End If
End Sub
' Create transport (T) dropdown from Z1 cache
Private Function BuildTransportList()
If z1Cache Is Nothing Then Call RefreshZ1Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z1Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z1Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildTransportList = dropdownList
End Function
' Create todoke (G) dropdown
Private Function BuildTodokeList()
If z4Cache Is Nothing Then Call RefreshZ4Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z4Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z4Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildTodokeList = dropdownList
End Function
' Create oufuku (M) dropdown
Private Function BuildOufukuList()
If oufukuList Is Nothing Then Call GetOufukuList
Dim dropdownList As String
Dim key As Variant
For Each key In oufukuList.Keys
Dim displayText As String
displayText = MakeSelect(key, oufukuList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildOufukuList = dropdownList
End Function
' Create Koutai (N) dropdown
Private Function BuildKoutaiList()
If koutaiList Is Nothing Then Call GetKoutaiList
Dim dropdownList As String
Dim key As Variant
For Each key In koutaiList.Keys
Dim displayText As String
displayText = MakeSelect(key, koutaiList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildKoutaiList = dropdownList
End Function
' Create Kettei (AU) dropdown
Private Function BuildKetteiList()
If z2Cache Is Nothing Then Call RefreshZ2Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z2Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z2Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildKetteiList = dropdownList
End Function
' Create Higaitou (AW) dropdown
Private Function BuildHigaitouList()
If higaitouList Is Nothing Then Call GetHigaitouList
Dim dropdownList As String
Dim key As Variant
For Each key In higaitouList.Keys
Dim displayText As String
displayText = MakeSelect(key, higaitouList(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildHigaitouList = dropdownList
End Function
' Create MonthAmountKbn (AX) dropdown
Private Function BuildMonthAmountKbnList()
If z3Cache Is Nothing Then Call RefreshZ3Cache
Dim dropdownList As String
Dim key As Variant
For Each key In z3Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, z3Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildMonthAmountKbnList = dropdownList
End Function
' Create Kanshoku (BC) dropdown
Private Function BuildKanshokuList()
If o2Cache Is Nothing Then Call RefreshO2Cache
Dim dropdownList As String
Dim key As Variant
For Each key In o2Cache.Keys
Dim displayText As String
displayText = MakeSelect(key, o2Cache(key)(0))
If dropdownList = "" Then
dropdownList = displayText
Else
dropdownList = dropdownList & "," & displayText
End If
Next key
BuildKanshokuList = dropdownList
End Function
' Create station (利用区間発) dropdown from M1_KukanD cache
Private Sub CreateFromStationDropdown(ByVal rowNum As Long, ByVal transportCol As Long, ByVal stationCol As Long)
If m1KukanDCache Is Nothing Then Call RefreshM1KukanDCache