Tea*_* Ai 3 excel vba excel-vba
我不明白下面的代码,请帮忙.
它继续针对变量b返回类型不匹配错误.
Dim a As Integer
Dim b As String
a = InputBox("Input the number of items", "Total Number of Items.")
b = InputBox("Which Block?", "Total Number of Items.")
Do While b <> "a" Or "A" Or "B" Or "b"
MsgBox ("Invalid Block. Try again, Input A or B")
b = InputBox("Which Block?", "SELECT BLOCK.")
Loop
If b = "a" Or "A" Then
Me.ComboBox1.List = Worksheets("Sheet1").Range("a3:a39").Value
Else
Me.ComboBox2.List = Worksheets("Sheet2").Range("a3:a35").Value
End If
Run Code Online (Sandbox Code Playgroud)
您可以使用Application.InputBox强制文本输入a和和数字输入b
使用UCASE$缩短您的测试
Dim a As Long
Dim b As String
a = Application.InputBox("Input the number of items", "Total Number of Items.", , , , , , 1)
b = Application.InputBox("Which Block?", "Total Number of Items.", , , , , 2)
Do While UCase$(b) <> "A" And UCase$(b) <> "B"
b = Application.InputBox("Which Block?", "Invalid Entry - Total Number of Items.", , , , , 2)
Loop
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3641 次 |
| 最近记录: |