How can I rename sheet tabs on workbook_open(). For exmaple I would like the Filename of the workbook as the label of the sheet1
How can I rename sheet tabs on workbook_open(). For exmaple I would like the Filename of the workbook as the label of the sheet1
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
[vba]
Private Sub Workbook_Open()
ThisWorkbook.SaveAs ActiveSheet.Name
End Sub
[/vba]
This is workbook event code.
To input this code, right click on the Excel icon on the worksheet (or next to the File menu if you maximise your workbooks), select View Code from the menu, and paste the code
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
The code that you give works but its on the other way around. I guess I have explained it very poorly sorry. Now i have twisted the code as follows but extension .xls comes out. How can I remove extension ".xls"
[vba]
Private Sub Workbook_Open()
ActiveSheet.Name = ThisWorkbook.Name 'this code give what i wanted to have but giving ".xls" extension.
End Sub
[/vba]
Originally Posted by xld
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.
[vba]
Private Sub Workbook_Open()
ActiveSheet.Name = Split(ThisWorkbook.Name,".")(0)
End Sub
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
Once again tnx xld...
T-ogether
E-veryone
A-chieves
M-ore
One who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever.