Error 2042
)和(空白)。
我的代码的相关部分是-
'Read Client Type Column
ClientType = Sht.Range(StartCell, Sht.Cells(LastRow, StartCell.Column))
'Find unique client names
Set UniqueType = CreateObject("Scripting.Dictionary")
For i = LBound(ClientType, 1) To UBound(ClientType, 1)
UniqueType(ClientType(i, 1)) = 1
Next i
Temp = UniqueType.Keys()
Cntr = 1
On Error Resume Next
For Each j In Temp
Set Cbx = UserForm1.Controls.Add("Forms.CheckBox.1")
Cbx.Caption = j
Cbx.Left = 15
Cbx.Top = 10 + (15 * (Cntr - 1))
Cntr = Cntr + 1
Next j
If UniqueType.Exists("") Then
UniqueType.Remove ""
UniqueType.Add "(Blanks)", 1
End If
适用于空白但不适用于不适用。
当我试着-
ClientType = Sht.Range(StartCell, Sht.Cells(LastRow, StartCell.Column)).Text
Run-time error '13': Type mismatch
当我跑的时候
UniqueType(ClientType(i, 1)) = 1
.