{{1}}
这是我的代码...当我运行代码时,工作表被创建为“数据”,但它没有退出循环...它正在创建“数据”工作表的复制并获得调试..我很遗憾非常小事情,我不知道它是什么..任何人都可以帮助..谢谢
答案 0 :(得分:0)
如果您的问题是在复制工作表后停止循环,请将您的代码更改为:
Dim j As Double
For j = 1 To Worksheets.Count
If Sheets(j).Range("E4").Value Like "Filters" Then
ActiveSheet.Copy before:=Worksheets(1)
ActiveSheet.Name = "data"
Exit For 'Or could be Exit Sub?
End If
Next j
答案 1 :(得分:0)
考虑:
Sub poiuyt()
Dim j As Long
For j = 1 To Worksheets.Count
With Sheets(j)
If .Range("E4").Value Like "Filters" Then
.Copy before:=Worksheets(1)
.Name = "data"
Exit Sub
End If
End With
Next j
End Sub