PDA

View Full Version : Solved: Workbook Filename to be the Sheet Tab Label



jammer6_9
12-12-2007, 05:32 AM
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

Bob Phillips
12-12-2007, 06:25 AM
Private Sub Workbook_Open()
ThisWorkbook.SaveAs ActiveSheet.Name
End Sub


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

jammer6_9
12-12-2007, 07:12 AM
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"


Private Sub Workbook_Open()
ActiveSheet.Name = ThisWorkbook.Name 'this code give what i wanted to have but giving ".xls" extension.

End Sub







Private Sub Workbook_Open()
ThisWorkbook.SaveAs ActiveSheet.Name
End Sub


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

Bob Phillips
12-12-2007, 07:14 AM
Private Sub Workbook_Open()
ActiveSheet.Name = Split(ThisWorkbook.Name,".")(0)

End Sub

jammer6_9
12-12-2007, 11:12 PM
Once again tnx xld...:clap: