Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Renaming sheet with VBA

I am doing some checks for specific text within the existing sheet name and
if the sheet name contains that value, I want to rename it to include
information from named range abc.

I'm using this to rename the sheet

Worksheets(i).Name = "TRY IT " & Range("abc") & " - Cover
Page"

I know I've got the right worksheet, but it's not being renamed. Does the
formula need to be changed?

Thanks,
Barb Reinhardt
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Renaming sheet with VBA

Barb,

Where is the code located? It should be in a regular code module,
not in a sheet module or the ThisWorkbook module. If you have it
in a sheet object module, you need to qualify the Range statement
to point to the sheet on which the range "abc" is defined. E.g,.

Worksheets(i).Name = _
"TRY IT " & Worksheets(1).Range("abc") & " - Cover Page """


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Barb Reinhardt" wrote
in message
...
I am doing some checks for specific text within the existing
sheet name and
if the sheet name contains that value, I want to rename it to
include
information from named range abc.

I'm using this to rename the sheet

Worksheets(i).Name = "TRY IT " & Range("abc") &
" - Cover
Page"

I know I've got the right worksheet, but it's not being
renamed. Does the
formula need to be changed?

Thanks,
Barb Reinhardt



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Renaming sheet with VBA


I used this code to rename all the sheets in an active workbook. I had
to set up the named range on EACH sheet and use a different value in
each so that the name would not be duplicated.


Code:
--------------------
Sub RenameSht()

For i = 1 To Worksheets.Count
Worksheets(i).Activate
Worksheets(i).Name = "TRY IT " & ActiveSheet.Range("abc") & " - Cover Page"
Next

End Sub
--------------------





Barb Reinhardt Wrote:
I am doing some checks for specific text within the existing sheet name
and
if the sheet name contains that value, I want to rename it to include
information from named range abc.

I'm using this to rename the sheet

Worksheets(i).Name = "TRY IT " & Range("abc") & " - Cover
Page"

I know I've got the right worksheet, but it's not being renamed. Does
the
formula need to be changed?

Thanks,
Barb Reinhardt



--
Excelenator


------------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...o&userid=36768
View this thread: http://www.excelforum.com/showthread...hreadid=565657

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
Prefix .xls] after renaming a sheet? Erchamion Excel Discussion (Misc queries) 6 April 25th 09 06:50 AM
Renaming a sheet [email protected] Excel Discussion (Misc queries) 3 May 30th 08 09:26 PM
adding a sheet and renaming oercim Excel Programming 2 March 29th 06 08:45 PM
Renaming a sheet Darin Kramer Excel Programming 2 September 20th 05 11:48 AM
renaming the active sheet tjtjjtjt[_2_] Excel Programming 1 January 27th 04 04:00 PM


All times are GMT +1. The time now is 12:28 AM.

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"