Autofill Worksheet names

  • Thread starter Thread starter Bonnie
  • Start date Start date
B

Bonnie

Is there a way in Excel 2000 to rename the first two
worksheets and then use an autofill type feature to add
more worksheets with a series of names? For example, name
one worksheet January, the next one February, then insert
new worksheets that would be automatically named the
consecutive months.

Bonnie
 
Bonnie

No way to do it as you describe, but the code below, if copied to your
personal.xls file will enable you to run the code after setting up the names
on a worksheet and selecting them. (You've described how easy it is to set
up the moths in cells, so you would just do that, highlight the cells and
run the code). It will set up worksheets in the order of the data. (It has
no error checking, so will bomb if you dupe a name or use illegal characters
for example)

Sub AddSheetsWithSelectedNames()
Dim rCell As Range
Dim wks As Worksheet
For Each rCell In Selection
Set wks = Worksheets.Add(After:=Worksheets(Worksheets.Count))
wks.Name = rCell.Value
Set wks = Nothing
Next rCell
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
Back
Top