excel vba中字符串数组判断单元格不能判断
如题,我在EXCELVBA中编写一下程序:PrivateSubCommandButton1_Click()Dimac(1To2)ac(1)="快"ac(2)="慢"IfC...
如题,我在EXCELVBA中编写一下程序:
Private Sub CommandButton1_Click()
Dim ac(1 To 2)
ac(1) = "快"
ac(2) = "慢"
If Cells(1, 1).Value = ac(1) Then
Cells(2, 1) = 1
Else: Cells(2, 1) = 0
End If
If Cells(1, 2).Value = ac(2) Then
Cells(2, 2) = 1
Else: Cells(2, 2) = 0
End If
End Sub
但是最终还是不能判断单元格的值,就算输入相等的输出也是0,是不是定义出问题?高手更正!!!!马上采纳 展开
Private Sub CommandButton1_Click()
Dim ac(1 To 2)
ac(1) = "快"
ac(2) = "慢"
If Cells(1, 1).Value = ac(1) Then
Cells(2, 1) = 1
Else: Cells(2, 1) = 0
End If
If Cells(1, 2).Value = ac(2) Then
Cells(2, 2) = 1
Else: Cells(2, 2) = 0
End If
End Sub
但是最终还是不能判断单元格的值,就算输入相等的输出也是0,是不是定义出问题?高手更正!!!!马上采纳 展开
若以下回答无法解决问题,邀请你更新回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询