Hey,
This simple code is giving me a headache. All I want to do is change any sheet on my workbook named "Sheet#" where # is any number, to "Sheet1". I also want to delete any sheets named Sheet1 beforehand.
When I run the code I can't around the fact that if Sheet1 is out of range. Is there a way to error handle an out of range? I would like it to skip anything that's out of range and not stop the macro.
And another note - is there a syntax I can use to circumvent this whole thing? Like "Sheet*"? The asterisk isn't working for me.
Sub Macro5()
Sheets("Sheet1").Delete
On Error Resume Next ' < this doesn't work for out of range?
For x = 1 To 100
If Sheets("Sheet" & x).Name = "" Then GoTo 4
Sheets("Sheet" & x).Name = "Sheet1"
GoTo 6
4
Next
6
end sub
Thanks for your help!
Edit - code put in code format. Anybody got an idea though?
Bookmarks