#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Sheets.name

Hi all.
I have a worksheet creation macro that I made by recording. Everything works
great-- until.... (ain't that always the way it goes.......)
I had it working fine until I got to one workbook in particular that the
names extended beyond how many worksheets were actually in the book (this
happens occasionally here).
I'd originally wanted to name the worksheet manually each time I made a new
one, but since I recorded this macro, and was unfamiliar at the time with
input boxes, I used the following:

Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Sheets.Count

What I'd like to do is to have an input box that I can give the new
worksheet a name of my choosing.

I tried a variation on the above and found that it's not worked.


Dim NewNm As String
NewNm = InputBox(Prompt:="What is the sheet number you want to call this _
worksheet?", Title:="New Abstract Worksheet Name")

Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Name = NewNm

what did I miss here?

It seems to get hung up at the sheets.name.
Thank you, in advance for your responses.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Sheets.name

On Apr 14, 12:07*pm, SteveDB1
wrote:
Hi all.
I have a worksheet creation macro that I made by recording. Everything works
great-- until.... (ain't that always the way it goes.......)
I had it working fine until I got to one workbook in particular that the
names extended beyond how many worksheets were actually in the book (this
happens occasionally here).
I'd originally wanted to name the worksheet manually each time I made a new
one, but since I recorded this macro, and was unfamiliar at the time with
input boxes, I used the following:

Sheets.Add After:=Sheets(Sheets.Count)
* Sheets(Sheets.Count).Name = Sheets.Count

What I'd like to do is to have an input box that I can give the new
worksheet a name of my choosing.

I tried a variation on the above and found that it's not worked.

Dim NewNm As String
NewNm = InputBox(Prompt:="What is the sheet number you want to call this _
worksheet?", Title:="New Abstract Worksheet Name")

* *Sheets.Add After:=Sheets(Sheets.Count)
* Sheets.Name = NewNm

what did I miss here?

It seems to get hung up at the sheets.name.
Thank you, in advance for your responses.


See how above it said "Sheets(Sheets.Count).Name = Sheets.Count" and
lastly you tried to do "Sheets.Name = NewNm"?

It doesn't know which sheet to name "NewNm" - so change that last line
to Sheets(Sheets.Count).Name = NewNm and you should be OK

HTH

Chris
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Sheets.name

that was it....
Thanks.


"cht13er" wrote:

On Apr 14, 12:07 pm, SteveDB1
wrote:
Hi all.
I have a worksheet creation macro that I made by recording. Everything works
great-- until.... (ain't that always the way it goes.......)
I had it working fine until I got to one workbook in particular that the
names extended beyond how many worksheets were actually in the book (this
happens occasionally here).
I'd originally wanted to name the worksheet manually each time I made a new
one, but since I recorded this macro, and was unfamiliar at the time with
input boxes, I used the following:

Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Sheets.Count

What I'd like to do is to have an input box that I can give the new
worksheet a name of my choosing.

I tried a variation on the above and found that it's not worked.

Dim NewNm As String
NewNm = InputBox(Prompt:="What is the sheet number you want to call this _
worksheet?", Title:="New Abstract Worksheet Name")

Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Name = NewNm

what did I miss here?

It seems to get hung up at the sheets.name.
Thank you, in advance for your responses.


See how above it said "Sheets(Sheets.Count).Name = Sheets.Count" and
lastly you tried to do "Sheets.Name = NewNm"?

It doesn't know which sheet to name "NewNm" - so change that last line
to Sheets(Sheets.Count).Name = NewNm and you should be OK

HTH

Chris

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sheets.name

Or...

Sheets.Add After:=Sheets(Sheets.Count)
activesheet.name = NewNm



SteveDB1 wrote:

Hi all.
I have a worksheet creation macro that I made by recording. Everything works
great-- until.... (ain't that always the way it goes.......)
I had it working fine until I got to one workbook in particular that the
names extended beyond how many worksheets were actually in the book (this
happens occasionally here).
I'd originally wanted to name the worksheet manually each time I made a new
one, but since I recorded this macro, and was unfamiliar at the time with
input boxes, I used the following:

Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = Sheets.Count

What I'd like to do is to have an input box that I can give the new
worksheet a name of my choosing.

I tried a variation on the above and found that it's not worked.

Dim NewNm As String
NewNm = InputBox(Prompt:="What is the sheet number you want to call this _
worksheet?", Title:="New Abstract Worksheet Name")

Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Name = NewNm

what did I miss here?

It seems to get hung up at the sheets.name.
Thank you, in advance for your responses.


--

Dave Peterson
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
Print sheets by "All Sheets in workbook, EXCEPT for specific named sheets". Possible? Corey Excel Programming 2 December 11th 06 01:35 AM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM


All times are GMT +1. The time now is 02:53 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"