Assign a name to worksheet tabs by code

H

hglamy

Hello there,

how can I - if at all - name or rename
XL worksheet tabs programmatically ?

Thank you in advance,

Kind regards,

H.G. Lamy
 
F

Frank Kabel

Hi
e.g.
Activesheet.name = "new name"

or
worksheets("Old name").name = "new name"
 
J

JMMach, MCSC

Sub RenameSheetTab()
ActiveSheet.Name = "New Name"
'or
Sheets("New Name").Name = "Renamed"
'where "New Name" is the existing name on the sheet tab
'or
Sheet3.Name = "New Sheet3"
'where "Sheet3" is the name of the Microsoft Excel Object in the VBE
Project Explorer
'The Microsoft Excel Objects are listed as ObjectName(SheetTabName)
'example: Sheet3(New Sheet3)
End Sub

TTFN
JMMach
 
G

Guest

How would you write this if you are wanting the tab to be named for a specific cell, of another worksheet in the same workbook?

----- JMMach, MCSC wrote: -----

Sub RenameSheetTab()
ActiveSheet.Name = "New Name"
'or
Sheets("New Name").Name = "Renamed"
'where "New Name" is the existing name on the sheet tab
'or
Sheet3.Name = "New Sheet3"
'where "Sheet3" is the name of the Microsoft Excel Object in the VBE
Project Explorer
'The Microsoft Excel Objects are listed as ObjectName(SheetTabName)
'example: Sheet3(New Sheet3)
End Sub

TTFN
JMMach
 

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