VBA code to populate Excel Tab Text

G

Guest

I would like to use VBA to enter tab's name in Excel's worksheet tab from a
cell in the worksheet. Lets say I have the word "Mickey Mouse" in cell A1 in
my worksheet. I would like to auto populate the worksheet's tab to show
Mickey Mouse. Any help here?
 
G

Gary Keramidas

you don't really need the activesheet.name when you use with activesheet.

one or the other will do

Sub test()
With ActiveSheet
.Name = Range("A1").Value
End With
End Sub

or

Sub test2()
ActiveSheet.Name = Range("A1").Value
End Sub


--


Gary


Charlie_Brown said:
This was exactly what I was looking for.
Thank you for your quick response!

Incidental said:
Hi CB

this should work

With ActiveSheet
ActiveSheet.Name = [A1]
End With

S
 

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