Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default using VBA to rename active sheet

I am writing some vba to run some stuff. Part of this includes naming,
copying, and returning to various sheets.
I want the write a code that will rename the first sheet "Data (altered)".
I can't seem to figure out how to do that. Any help would be much
appreciated.

TIA
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default using VBA to rename active sheet

Worksheets(1).Name = "Data (altered)"

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I am writing some vba to run some stuff. Part of this includes naming,
copying, and returning to various sheets.
I want the write a code that will rename the first sheet "Data (altered)".
I can't seem to figure out how to do that. Any help would be much
appreciated.

TIA



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


If you are renaming the active sheet use:

ActiveSheet.Name = "Date (altered)"

If you are renaming the first sheet use:

Sheets(1).Name = "Date (altered)"

If you are renaming a sheet with a specific name use:

Sheets("Sheet1").Name = "Date (altered)"




--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26966

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 148
Default using VBA to rename active sheet

That worked! thanks

"Tom Ogilvy" wrote:

Worksheets(1).Name = "Data (altered)"

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I am writing some vba to run some stuff. Part of this includes naming,
copying, and returning to various sheets.
I want the write a code that will rename the first sheet "Data (altered)".
I can't seem to figure out how to do that. Any help would be much
appreciated.

TIA




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default using VBA to rename active sheet

Hi, what you said before is really good,

Do you know how I can make it work so that I can make Sheet1 become renamed
"1", sheet 2 is renamed "2", sheet 3 become "3" and then I can add multiple
sheets in the same sequence?

If you can help it would be much appreciated.

Thanks.

"kkknie" wrote:


If you are renaming the active sheet use:

ActiveSheet.Name = "Date (altered)"

If you are renaming the first sheet use:

Sheets(1).Name = "Date (altered)"

If you are renaming a sheet with a specific name use:

Sheets("Sheet1").Name = "Date (altered)"


K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...fo&userid=7543
View this thread: http://www.excelforum.com/showthread...hreadid=269668




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using VBA to rename active sheet


Not sure exactly what your up to, but here's my thoughts:

Sheets("Sheet1").Name = 1
Sheets("Sheet2").Name = 2
Sheets("Sheet3").Name = 3

Or if you want to do them in a loop based on their orignal names,

Dim i As Integer

For i = 1 to 3
Sheets("Sheet" & i).Name = i
Next

If you want to just rename the sheets based on how they are currentl
ordered,

Dim i As Integer

For i = 1 To Worksheets.Count
Sheets(i).Name = i
Next

Hope this helps,



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26966

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
how do i rename a sheet if the rename tab is inactive? Nelson Excel Worksheet Functions 1 March 3rd 10 10:28 AM
Move data to new sheet - rename sheet based on criteria ? [email protected] Excel Discussion (Misc queries) 7 May 16th 07 10:22 PM
Rename active sheet lumaduc Excel Programming 1 June 3rd 04 08:46 PM
Rename active sheet Ginny[_2_] Excel Programming 2 January 9th 04 10:59 PM
Rename Active Sheet Jason[_25_] Excel Programming 2 September 21st 03 02:03 AM


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