Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Naming Worksheets with a Macro
I am trying to use a macro to create a copy of a worksheet. After inserting
sheet1 I can go it (worksheet("sheet1").select) then rename it to a standard name. However, when I run the macro again, the next new sheet is now called sheet2 which interferes with the macro that is looking for Sheet1. Is there a way to use a formula to rename worksheets. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Naming Worksheets with a Macro
Barry,
This copies "Sheet1" (in the book with the macro) and renames the copy. Change ThisWorkbook to ActiveWorkbook or other workbook name if the sheet to be copied is not in the book with the macro: Sub test() With ThisWorkbook .Worksheets("Sheet1").Copy after:=.Worksheets(.Worksheets.Count) ActiveSheet.Name = "MySpecialName" 'the new copy is now the active sheet End With End Sub hth, Doug "BarryL" wrote in message ... I am trying to use a macro to create a copy of a worksheet. After inserting sheet1 I can go it (worksheet("sheet1").select) then rename it to a standard name. However, when I run the macro again, the next new sheet is now called sheet2 which interferes with the macro that is looking for Sheet1. Is there a way to use a formula to rename worksheets. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Naming worksheets within a macro | Excel Worksheet Functions | |||
Naming worksheets... | Excel Discussion (Misc queries) | |||
naming worksheets | Excel Worksheet Functions | |||
Naming Worksheets in VBE | Excel Programming | |||
Naming Worksheets in VBE | Excel Programming |