![]() |
Add file name to end of all sheet name
Does anybody has a macro which would add the file name of my active
workbook to all sheet name of the workbook eg if file name is file.xls & sheetA & sheetB & sheetC macro will rename sheets as foll: sheetA - file (without extension ".xls") sheetB - file sheetC - file thxs |
Add file name to end of all sheet name
Sub SheetnameANDWorkbook()
ActiveSheet.Name = ActiveSheet.Name & "-" & Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) End Sub can anybody debug above - as I having error with: & "-" & Thxs wrote: Does anybody has a macro which would add the file name of my active workbook to all sheet name of the workbook eg if file name is file.xls & sheetA & sheetB & sheetC macro will rename sheets as foll: sheetA - file (without extension ".xls") sheetB - file sheetC - file thxs |
Add file name to end of all sheet name
Hi TransferXXX,
Try: '============= Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim sStr As String Set WB = ActiveWorkbook sStr = Left(WB.Name, Len(WB.Name) - 4) For Each SH In WB.Worksheets SH.Name = SH.Name & " - " & sStr Next SH End Sub '<<============= --- Regards, Norman wrote in message oups.com... Does anybody has a macro which would add the file name of my active workbook to all sheet name of the workbook eg if file name is file.xls & sheetA & sheetB & sheetC macro will rename sheets as foll: sheetA - file (without extension ".xls") sheetB - file sheetC - file thxs |
Add file name to end of all sheet name
thxs work great !!
Norman Jones wrote: Hi TransferXXX, Try: '============= Public Sub Tester() Dim WB As Workbook Dim SH As Worksheet Dim sStr As String Set WB = ActiveWorkbook sStr = Left(WB.Name, Len(WB.Name) - 4) For Each SH In WB.Worksheets SH.Name = SH.Name & " - " & sStr Next SH End Sub '<<============= --- Regards, Norman wrote in message oups.com... Does anybody has a macro which would add the file name of my active workbook to all sheet name of the workbook eg if file name is file.xls & sheetA & sheetB & sheetC macro will rename sheets as foll: sheetA - file (without extension ".xls") sheetB - file sheetC - file thxs |
All times are GMT +1. The time now is 07:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com