0
votes

Copy sheet using its codename and place it after a specified sheet's codename

Example.

Worksheets("Sheet2").Copy After:=Sheets("Sheet5")

the above code works but uses the sheets display name and not the sheet's codename

2

2 Answers

0
votes

This?

Sheet2.Copy After:=Sheet5
0
votes

You can use a sheet's index instead of the stated name, like so:

Worksheets(2).Copy After:=Worksheets(5)