Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding/deleting ranges and renaming accordingly Michael Siegel[_2_] Excel Programming 0 April 10th 07 02:55 PM
renaming worksheet draganpi Excel Programming 2 April 6th 06 12:06 PM
adding a sheet and renaming oercim Excel Programming 2 March 29th 06 08:45 PM
Renaming adding and deleting directory alanford Excel Programming 2 February 16th 05 11:08 AM
Renaming the Worksheet through VBA abxy[_24_] Excel Programming 4 February 9th 04 07:32 PM


All times are GMT +1. The time now is 12:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"