Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do i rename a sheet if the rename tab is inactive? | Excel Worksheet Functions | |||
Move data to new sheet - rename sheet based on criteria ? | Excel Discussion (Misc queries) | |||
Rename active sheet | Excel Programming | |||
Rename active sheet | Excel Programming | |||
Rename Active Sheet | Excel Programming |