Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello,
I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. -- Cue |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Perhaps assign file name to variable, then assign variable to Tab.
Cue wrote: Hello, I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub RenameSheet()
Dim myname myname = ThisWorkbook.Name ActiveSheet.Select ActiveSheet.Name = myname Range("A1").Select End Sub Vaya con Dios, Chuck, CABGx3 "Cue" wrote: Hello, I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. -- Cue |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
Sheets("sheet1").Name = ActiveWorkbook.Name regards FSt1 "Cue" wrote: Hello, I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. -- Cue |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Great! Thanks to both of you for your assistance.
One thing i did not account for... Is there a way rename the tab with the filename with the ".xls"? -- Cue |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Excuse me...
Is there a way rename the tab with the filename without the ".xls"? -- Cue "Cue" wrote: Great! Thanks to both of you for your assistance. One thing i did not account for... Is there a way rename the tab with the filename with the ".xls"? -- Cue |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'll try that. Thanks.
-- Cue "Bob I" wrote: Perhaps assign file name to variable, then assign variable to Tab. Cue wrote: Hello, I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. . |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
now you will have to use variables. Sub nametab() Dim s As String Dim ss As String s = ActiveWorkbook.Name ss = Left(s, Len(s) - 4) Sheets("Sheet1").Name = ss End Sub regards FSt1 "Cue" wrote: Excuse me... Is there a way rename the tab with the filename without the ".xls"? -- Cue "Cue" wrote: Great! Thanks to both of you for your assistance. One thing i did not account for... Is there a way rename the tab with the filename with the ".xls"? -- Cue |
#9
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I would suggest to try the following code.
1) It will work, as expected, in "Excel 2007 and 2010" 2) It may be run from within a Module and it will rename the Active Sheet at that moment. There is alao another "workaround" by checking the Excels version and then cut-off 4 or 5 characters from the end. ---------------------- Sub NameTab() ActiveSheet.Name = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, ".") - 1) End Sub -------------- Micky "Cue" wrote: I'll try that. Thanks. -- Cue "Bob I" wrote: Perhaps assign file name to variable, then assign variable to Tab. Cue wrote: Hello, I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. . |
#10
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks everyone! All your solutions worked!
I found this similar to CLR solution: Sheets("Sheet2").Name = Replace(ActiveWorkbook. Name, ".xls", "") Thanks again everyone for your help! -- Cue "Cue" wrote: I'll try that. Thanks. -- Cue "Bob I" wrote: Perhaps assign file name to variable, then assign variable to Tab. Cue wrote: Hello, I am trying to rename a worksheet tab using the name of the workbook. Each code I've tried does not work. Does anybody have a simple macro to accomplish this? Thanks. . |
#11
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks everyone. Of course, all of your solutions worked. Now I have to
decide which one to use. Thanks again to all of you! -- Cue |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro: Copy a worksheet and rename it to a specified value | Excel Discussion (Misc queries) | |||
Macro to copy a worksheet and rename based upon text entered in 1 | Excel Discussion (Misc queries) | |||
Rename worksheet in macro | Excel Worksheet Functions | |||
new worksheet and rename from cell contents macro | Excel Worksheet Functions | |||
How to set SAVE AS file name to equal A1 contents when rename file | Excel Discussion (Misc queries) |