Macro Code ... Next Sheet

  • Thread starter Thread starter Ken
  • Start date Start date
K

Ken

I have many many files where I want to change the name of
the Tab Sheets from whatever they are now to a new
name ... simply "Page 1", "Page 2", "Page 3" etc ... I
would like to do this with a Macro ... but need code ...

Select 1st sheet regardless of name ... rename to "Page 1"
Select 2nd sheet regardless of name ... rename to "Page 2"
Select 3rd sheet regardless of name ... rename to "Page 3"

The number of tab sheets vary so I assume Macro will
simply abend when it reaches the end ... Unless of course
you highly respected Wizards on this board have other
Magic to perform.

Thanks ... Kha
 
Ken,

For i = 1 To Worksheets.Count
Worksheets(i).Name = "Page " & i
Next

No abends.
 
Hi,



Use this macro :



Sub NewShName()

Dim sh As Worksheet

Dim intN As Integer

For Each sh In Worksheets

intN = intN + 1

sh.Name = "page " & intN

Next sh

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top