VBA的新手,如果有人可以帮助我,我在这里做错了什么.尝试运行循环以查找特定文本,启动循环然后在特定点停止.循环是这样的,我希望它在我的工作表中复制下面的一些值,因此a是55.我面临错误Block IF没有End If
这是代码:
Private Sub CommandButton3_Click()
For y = 1 To 15 Step 5
Dim x As Double
Dim a As Double
x = 1
a = 55
If Cells(x, y).Value = "Text1" Then
Do Until Cells(x, y).Value = "Text2"
Cells(a, y) = Cells(x, y).Value
Cells(a, y + 1) = Cells(x, y + 1)
x = x + 1
a = a + 1
Loop
End Sub
Run Code Online (Sandbox Code Playgroud)