Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Copy Sheet with Next SheetName Number

Status
Not open for further replies.

Salut39

Technical User
Aug 2, 2006
178
GB
Hi Guys,

I need help on creating simple macro which will copy a worksheet named "001" with the next sequential number "002" and then "002" to "003" and so on.

Thanks
Yuri
 
I have very basic knowledge I recorded:

Sheets("001").Select
Sheets("001").Copy Before:=Sheets(1)
Sheets("001 (2)").Select
Sheets("001 (2)").Name = "005
 



Hi,
Code:
    Sheets("001").Copy Before:=Sheets(1)
    Sheets(1).Name = Format(Sheets.Count, "000")

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Thanks Skip,

That works well, it counts sheets creating next number. It's good enough but if there are other sheets named "summary" for example it count them too. But I can work around this.

Thanks
 



Minus ONE, if you have ONE sheet that is not "numbered".

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top