Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Create a new worksheet with a macro and giving it a specific name
I'm trying to create a new worksheet with a macro where the worksheet has a
specific name. However, when the macro creates the worksheet, it creates one with the name "SheetXX". I can continue the macro to rename "SheetXX" to the specific name I want, but captured in the macro is referenece to "SheetXX". When I run the macro again, it creates a new worksheet with the name "SheetXX+1" and then bombs out because it can't find "SheetXX" to rename it to the specific name that I want. Anyway to to have the macro create the new worksheet with the specific name without having to have the Excel generated "SheetXX" name and then having to rename it to the specific name? Thanks for your help. Steve Krieger |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Create a new worksheet with a macro and giving it a specific name
The short answer is no. When a new sheet is created XL gives it a name as you
have specified. You can then just rename it and then reference it by that name. Worksheets.Add ActiveSheet.Name = "Tada" Worksheets("Tada").range("A1").Value = "Hello World" -- HTH... Jim Thomlinson "Steve Krieger" wrote: I'm trying to create a new worksheet with a macro where the worksheet has a specific name. However, when the macro creates the worksheet, it creates one with the name "SheetXX". I can continue the macro to rename "SheetXX" to the specific name I want, but captured in the macro is referenece to "SheetXX". When I run the macro again, it creates a new worksheet with the name "SheetXX+1" and then bombs out because it can't find "SheetXX" to rename it to the specific name that I want. Anyway to to have the macro create the new worksheet with the specific name without having to have the Excel generated "SheetXX" name and then having to rename it to the specific name? Thanks for your help. Steve Krieger |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Create a new worksheet with a macro and giving it a specific n
Thanks so much! With a little bit of editing I was able to get it to do what
I wanted. Steve "Jim Thomlinson" wrote: The short answer is no. When a new sheet is created XL gives it a name as you have specified. You can then just rename it and then reference it by that name. Worksheets.Add ActiveSheet.Name = "Tada" Worksheets("Tada").range("A1").Value = "Hello World" -- HTH... Jim Thomlinson "Steve Krieger" wrote: I'm trying to create a new worksheet with a macro where the worksheet has a specific name. However, when the macro creates the worksheet, it creates one with the name "SheetXX". I can continue the macro to rename "SheetXX" to the specific name I want, but captured in the macro is referenece to "SheetXX". When I run the macro again, it creates a new worksheet with the name "SheetXX+1" and then bombs out because it can't find "SheetXX" to rename it to the specific name that I want. Anyway to to have the macro create the new worksheet with the specific name without having to have the Excel generated "SheetXX" name and then having to rename it to the specific name? Thanks for your help. Steve Krieger |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to run specific macro on selected worksheet? | Excel Discussion (Misc queries) | |||
Macro to Move Specific Data to Another Worksheet | Excel Worksheet Functions | |||
make a macro 'worksheet specific' | Excel Discussion (Misc queries) | |||
How do you create a menu for just that specific worksheet? | Excel Discussion (Misc queries) | |||
Help with a macro to open to a specific worksheet | Excel Worksheet Functions |