Naming sheets from a cell value

G

Guest

Hi there,
Thanks for reading my question.
Is it possible to name a sheet from a cell value with in the sheet? i.e. I
have 12 sheets, each sheet represents a month and the month value is in cell
A1. Can I rename a sheet by refering to cell A1 instead of manually renaming
the sheets to January, February etc.

Many thanks

Tony
 
G

Guest

Thanks for the quick response. Stupid question! When does the code get
executed? I tried pressing F9, or do I have to change something?

Thanks again
 
J

JE McGimpsey

If you put it in the worksheet code module, per the instructions, the
macro will fire whenever a cell in the sheet is changed manually.
 
K

kathy

Hi ..I am really green at this.. could you please help me by starting with
where to creat this macro .. I have tried.. cannot seem to make it happen
 
K

kathy

can we take this abit farther? I'd like then tab names to come up in reverse
order..is there away of doing this? e.g going from left to right December to
the left and January to the far right? also if there is a date formula in A1
how do I change the macro as it wants only to read text..
 
D

Don Guillett

I don't see the first part of the thread but try

sub namesheets()
for i=1 to 12
sheets(i).name=sheets(i).range("a1")
next
end sub
 
K

kathy

this is what I was working from just want the dates to appear on the tabs in
reverse order from what this does..
 
K

kathy

here is one more that worked but now is giving me a"compile error code
-variable not defined"
on the "intTemp = 2"part
here is the whole thing..

Sub createmonthsheets()
'Dim intTemp
Dim dtTemp As Date
dtTemp = "Jan 10"
ActiveWorkbook.Sheets.Add Count:=(12 - 1 - ActiveWorkbook.Sheets.Count)
For intTemp = 2 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Sheets(intTemp).Name = _
Format(DateAdd("y", (intTemp - 2), dtTemp), "mmm-yy")
Next
ActiveWorkbook.Save
End Sub
 
K

kathy

yes that got the thing to run but I still have the months listed as Jan to
December left to right and I need them the other direction Dec to Jan left to
right.. I appreciate your input..
 

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