Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a Worksheet and Renaming
I am trying to add a Working in a Macro and then renaming the
Worksheet, but Excel likes to name the Sheets 1,2,3,etc, and you don't know what the sheet name will be to select to rename at the time you run the Macro. The following is a simple code that I have so far: mnth = Cells(1, 4) Sheets.Add Sheets("Sheet2").Select Sheets("Sheet2").Name = mnth Can anyone help me get a solution to this problem? Frank |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a Worksheet and Renaming
Try:
Sub NewWks() Sheets.Add res = InputBox("What is the New Sheet Name?") ActiveSheet.Name = res End Sub Corey.... wrote in message ... I am trying to add a Working in a Macro and then renaming the Worksheet, but Excel likes to name the Sheets 1,2,3,etc, and you don't know what the sheet name will be to select to rename at the time you run the Macro. The following is a simple code that I have so far: mnth = Cells(1, 4) Sheets.Add Sheets("Sheet2").Select Sheets("Sheet2").Name = mnth Can anyone help me get a solution to this problem? Frank |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a Worksheet and Renaming
On Jun 2, 9:38*pm, "Corey ...." wrote:
Try: Sub NewWks() * * Sheets.Add * * res = InputBox("What is the New Sheet Name?") * * ActiveSheet.Name = res End Sub wrote in message ... I am trying to add a Working in a Macro and then renaming the Worksheet, but Excel likes to name the Sheets 1,2,3,etc, and you don't know what the sheet name will be to select to rename at the time you run the Macro. *The following is a simple code that I have so far: * *mnth = Cells(1, 4) * *Sheets.Add * *Sheets("Sheet2").Select * *Sheets("Sheet2").Name = mnth Can anyone help me get a solution to this problem? Frank- Hide quoted text - - Show quoted text - Thanks for your help. Frank |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adding a Worksheet and Renaming
Frank,
Dim mnth As String mnth = Cells(1, 4).Text Worksheets.Add befo=Worksheets(1), Count:=1 Worksheets(1).Name = mnth -- Jim Cone Portland, Oregon USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) wrote in message I am trying to add a Working in a Macro and then renaming the Worksheet, but Excel likes to name the Sheets 1,2,3,etc, and you don't know what the sheet name will be to select to rename at the time you run the Macro. The following is a simple code that I have so far: mnth = Cells(1, 4) Sheets.Add Sheets("Sheet2").Select Sheets("Sheet2").Name = mnth Can anyone help me get a solution to this problem? Frank |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding/deleting ranges and renaming accordingly | Excel Programming | |||
renaming worksheet | Excel Programming | |||
adding a sheet and renaming | Excel Programming | |||
Renaming adding and deleting directory | Excel Programming | |||
Renaming the Worksheet through VBA | Excel Programming |