Renaming worksheets

  • Thread starter Thread starter Patrick Simonds
  • Start date Start date
P

Patrick Simonds

I thought I had this working but apparently not. I have 100+ worksheets in
my workbook, I need a macro which when run will rename each worksheet to the
worksheets cell AB1 (each worksheet will have its own cell AB1 which will
contain the text to be used as the worksheets name) and when it is done it
must return me to the worksheet which was active when called the macro.
 
Dim WS as Worksheet
for each WS in Worksheets
WS.name = WS.Range("AB1"=.value
next WS


HTH
 
Hi Patrick,

Try:

'=============>>
Public Sub Tester001()
Dim SH As Worksheet

For Each SH In ActiveWorkbook.Worksheets
SH.Name = SH.Range("AB1").Value
Next SH

End Sub
'<<=============

Since no selecrions are made, the active sheet does not change,
 
Typo alert.

Dim WS as Worksheet
for each WS in Worksheets
WS.name = WS.Range("AB1").value
next WS

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Thanks!

--
AP

Bob Phillips said:
Typo alert.

Dim WS as Worksheet
for each WS in Worksheets
WS.name = WS.Range("AB1").value
next WS

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

done
 
This does not seem to work. It runs through all the sheets but does not
rename them. This is what is found in cell AB1:

=TEXT($A$4,"dd mmm yy")

I did not referance cell A4 directly because it contained a formula to
arrive at the date.
 

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