感谢您的帮助。我可能没有适当地迭代。也许我应该为活动表分配一个整数?
Sub TabNames()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ActiveSheet.Name = "herp"
Next ws
ActiveSheet.Name = "derp"
Next ws
ActiveSheet.Name = "herp derp"
Next ws
ActiveSheet.Name = "derp herp"
Next ws
ActiveSheet.Name = "herp herp"
Next ws
ActiveSheet.Name = "derp derp"
End Sub
答案 0 :(得分:1)
Sub TabNames()
Dim arrNames, x as integer
arrNames = Array("herp", "herp derp", "derp herp", "herp herp", "derp derp")
For x = 1 to ActiveWorkbook.Worksheets.Count
ActiveWorkbook.Worksheets(x).Name = arrNames(x-1)
Next x
End Sub
答案 1 :(得分:0)
ActiveSheet
与您的程序相同,因此您只需反复更改当前/可见工作表的名称。
使用这样的行:
ws.Name = "herp"
等...