Excel 2002 : Can I speed fill tabs ?

G

Guest

Dear Sir,

My I know if I can speed fill the name of each worksheet (tab) in certain
sequence such as :

1 Jan-07, Feb07, Mar-07....
2. 1997, 1998, 1999, 2000 ...
2. Sun, Mon Tue, Wed ...
3 1/6, 2/6, 3/6.....
4 XP1, XP2, XP3 ...

I find that it is very time consuming and tedious to rename large number of
pages.

Thanks

Low
 
D

Dave Peterson

You can use macros to do this kind of work--except for #3. You can't use
slashes in worksheet names.

#1.
Dim iCtr As Long
Dim wks As Worksheet
iCtr = 0
For Each wks In ActiveWorkbook.Worksheets
iCtr = iCtr + 1
wks.Name = Format(DateSerial(2007, iCtr, 1), "mmm-yy")
Next wks

#2.
Dim iCtr As Long
Dim wks As Worksheet
iCtr = 1996
For Each wks In ActiveWorkbook.Worksheets
iCtr = iCtr + 1
wks.Name = iCtr
Next wks

#2. (with 7 or less worksheets):
Dim iCtr As Long
For iCtr = 1 To 7
Worksheets(iCtr).Name = Format(iCtr, "ddd")
Next iCtr

#4.
Dim iCtr As Long
Dim wks As Worksheet
iCtr = 0
For Each wks In ActiveWorkbook.Worksheets
iCtr = iCtr + 1
wks.Name = "XP" & iCtr
Next wks
 
D

David McRitchie

Adding to Dave's reply, the worksheet names are text, and
I would suggest naming worksheets with sorting in mind. Name a dated
worksheet as yyyy-mm-dd to keep out of trouble instead of mm-dd-yy
or mmm-dd. Use yyyy_mmdd if you want it a little shorter name.

Sorting worksheets into tabname order
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#sortallsheets

Same naming would be suggested for filenames in a directory that
are representing dates.
 
G

Guest

Hello David,

Thanks for the info.

Low

--
A36B58K641


David McRitchie said:
Adding to Dave's reply, the worksheet names are text, and
I would suggest naming worksheets with sorting in mind. Name a dated
worksheet as yyyy-mm-dd to keep out of trouble instead of mm-dd-yy
or mmm-dd. Use yyyy_mmdd if you want it a little shorter name.

Sorting worksheets into tabname order
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#sortallsheets

Same naming would be suggested for filenames in a directory that
are representing dates.
 

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