Hey,
So I've started to pick up on using codenames when writing scripts, majority of them I can pull them off or learn the workaround but in my example.. say I have 10 sheets, all codenames are sheet1, sheet2, sheet3 etc.. why does this code not work when referring? Why does it not pick up as Sheet2.Delete?
If anyone can give me guidance on codenames e.g. is it the preferred way, is it the most efficient, what are the cons to using vs sheet name and index other than it can pinpoint a sheet more accurately where sheet names and indexs can change constantly.
**Just to note, I do not want to refer by their index OR tab name.
So I've started to pick up on using codenames when writing scripts, majority of them I can pull them off or learn the workaround but in my example.. say I have 10 sheets, all codenames are sheet1, sheet2, sheet3 etc.. why does this code not work when referring? Why does it not pick up as Sheet2.Delete?
If anyone can give me guidance on codenames e.g. is it the preferred way, is it the most efficient, what are the cons to using vs sheet name and index other than it can pinpoint a sheet more accurately where sheet names and indexs can change constantly.
**Just to note, I do not want to refer by their index OR tab name.
Code:
Sub test()
Application.ScreenUpdating = False
For I = 2 To 10
Sheet & I.Delete
Next
Application.ScreenUpdating = True
End Sub
Last edited: