lhernandez
Active Member
- Joined
- May 22, 2006
- Messages
- 282
Hello!
I am currently trying to copy a worksheet and rename the copied worksheet. Based on my other code this could be performed multiple times so there is no way to know the exact name of the worksheet i will be renaming.
I am using the following:
Set ws = Sheets("Sheet1")
ws.Select
ws.Copy after:=Sheets(3)
ws.Name = "Test"
What ends up happening is "Sheet1" is copied after "Sheet3", which at this point would be names "Sheet1 (2)", and the original "Sheet1" is renamed to "Test"...is there a way to set the copied sheet, "Sheet1 (2)" to be renamed as "Test"?
Thanks for your help in advance
I am currently trying to copy a worksheet and rename the copied worksheet. Based on my other code this could be performed multiple times so there is no way to know the exact name of the worksheet i will be renaming.
I am using the following:
Set ws = Sheets("Sheet1")
ws.Select
ws.Copy after:=Sheets(3)
ws.Name = "Test"
What ends up happening is "Sheet1" is copied after "Sheet3", which at this point would be names "Sheet1 (2)", and the original "Sheet1" is renamed to "Test"...is there a way to set the copied sheet, "Sheet1 (2)" to be renamed as "Test"?
Thanks for your help in advance