How do I rename multiple sheets at one time in Excel?

G

Guest

I created a budget template for 2006. Each sheet was named Jan. 06, Feb 06
and so on. I then created another set of budgets for 07 but failed to change
the titles on the sheet tabs. I was wondering if I could change each tab to
say the month and 07 without selecting each one manually. Can I do this?
 
G

Guest

This code will work, assuming you are using 3-letter abbreviations for the
months. Cpoy and poste it into a VBA module, then run it.

Sub Rename()

Dim stString As String
Dim x As Integer


For x = 1 To 3

stString = Left(Worksheets(x).Name, 3)

Worksheets(x).Name = stString & " 07"

Next x

End Sub
 
G

Guest

Thanks for the code but I am sorry to report you are dealing with a low class
peon who doesn' know what the VPA module is. Could you clarify with a step by
step if at all possible. Thanks

ChrisD
 
G

Guest

Everyone starts somewhere. I started by recording macros and looking at them
in 'edit' mode to see what they were doing. (tip)

Here's the steps

type <Alt>F11 to open the VBA editor

Select "Insert" "Module"

a new folder labeled Modlues will appear in the project window on the left
and a blank page will be in the main window.

copy and paste the code into that blank space.

Then click the arrow shaped button at the top to run the code (looks like
the 'play' button on your Media Player). The code will run..

Look at your spreadsheet and confirm the results.
 

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

Top