|
Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Dim ar As Variant
Dim d As Object, dc As Object
Set d = CreateObject("scripting.dictionary")
Set dc = CreateObject("scripting.dictionary")
With Sheets("收入登记表")
r = .Cells(Rows.Count, 2).End(xlUp).Row
y = .Cells(1, Columns.Count).End(xlToLeft).Column
If r < 2 Then MsgBox "收入登记表为空!": End
If y < 14 Then MsgBox "收入登记表年月为空!": End
ar = .Range("b2:b" & r)
br = .Range(.Cells(1, 14), .Cells(1, y))
End With
For i = 2 To UBound(ar)
If Trim(ar(i, 1)) <> "" Then
d(Trim(ar(i, 1))) = ""
End If
Next i
For j = 1 To UBound(br, 2)
If Trim(br(1, j)) <> "" Then
zd = Format(br(1, j), "yyyy年m月")
dc(zd) = ""
End If
Next j
Me.Cmb户省.List = d.keys
Me.Cmb户市.List = dc.keys
Set d = Nothing
Set dc = Nothing
End Sub |
|