在excel无效的Next 控件变量引用 大神们谁知道啊??、、、
发布网友
发布时间:2022-04-23 02:47
我来回答
共1个回答
热心网友
时间:2023-05-04 22:19
有两个next i,删掉一个
next 后面的变量可以省略不写
Private Sub CommandButton1_Click()
x = 0
If Cells(1, 1) <> "" Then
cx = Cells(1, 1)
For p = 1 To 3
Worksheets(p).Select
For i = 2 To 100
For j = 1 To 20
If Worksheets(p).Cells(i, j) = cx Then
Worksheets(p).Cells(i, j).Select
MsgBox "任意键继续..."
x = x + 1
End If
Next
Next
Next
End If
Worksheets(1).Select
Cells(1, 1).Select
If x = 0 Then
MsgBox "无相关记录"
End If
End Sub