Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename a sheet


I have a workbook that references different sheets with the command

Sheets(1).Select

Problem is this sheet somehow no longer exists in my workbook.

When i get to this line in my code it errors out because the sheet doe
not exist. Is there a way to rename one of my other sheets, say Sheet
to be Sheets(1)

Any help is great.

Gree

--
greenfalco
-----------------------------------------------------------------------
greenfalcon's Profile: http://www.excelforum.com/member.php...fo&userid=1362
View this thread: http://www.excelforum.com/showthread.php?threadid=39185

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Rename a sheet

1 is an idex number indicating the first sheet in the tab order if all
sheets are visible. Possibly, you have made the first sheet hidden, so it
can't be selected.

--
Regards,
Tom Ogilvy

"greenfalcon"
wrote in message
...

I have a workbook that references different sheets with the command

Sheets(1).Select

Problem is this sheet somehow no longer exists in my workbook.

When i get to this line in my code it errors out because the sheet does
not exist. Is there a way to rename one of my other sheets, say Sheet2
to be Sheets(1)

Any help is great.

Green


--
greenfalcon
------------------------------------------------------------------------
greenfalcon's Profile:

http://www.excelforum.com/member.php...o&userid=13622
View this thread: http://www.excelforum.com/showthread...hreadid=391859



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename a sheet


hmm now that im looking at this, how is it even possible tha
Sheets(1).Select returns an error? isnt it always there because it is
reference to the sheets in a workbook

--
greenfalco
-----------------------------------------------------------------------
greenfalcon's Profile: http://www.excelforum.com/member.php...fo&userid=1362
View this thread: http://www.excelforum.com/showthread.php?threadid=39185

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename a sheet


I just found this from a vba developers site

"Index Number
A sheets Index number is determined by its position in the Workbook
The left most sheet will always have an Index number of 1, the next o
the right will be 2 and so on. Excel VBA allows us to specify any Shee
by using it's Index number, but unfortunately this method is not used b
Excel when we record a macro. It uses the Sheets Tab name like
Sheets("Budget").Select If this sheet was the third from the left w
could use: Sheets(3).Select. This is often a better option than usin
the sheet tab name, but still has potential problems. By this I mean
the sheets position in the Workbook could change if we add, remove o
move sheets."

how is it possible that Sheet(1) does not exist in my program

--
greenfalco
-----------------------------------------------------------------------
greenfalcon's Profile: http://www.excelforum.com/member.php...fo&userid=1362
View this thread: http://www.excelforum.com/showthread.php?threadid=39185

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Rename a sheet

It isn't possible that it doesn't exist. It is possible that you can't
select it.

--
Regards,
Tom Ogilvy

"greenfalcon"
wrote in message
...

I just found this from a vba developers site

"Index Number
A sheets Index number is determined by its position in the Workbook.
The left most sheet will always have an Index number of 1, the next on
the right will be 2 and so on. Excel VBA allows us to specify any Sheet
by using it's Index number, but unfortunately this method is not used by
Excel when we record a macro. It uses the Sheets Tab name like;
Sheets("Budget").Select If this sheet was the third from the left we
could use: Sheets(3).Select. This is often a better option than using
the sheet tab name, but still has potential problems. By this I mean,
the sheets position in the Workbook could change if we add, remove or
move sheets."

how is it possible that Sheet(1) does not exist in my program?


--
greenfalcon
------------------------------------------------------------------------
greenfalcon's Profile:

http://www.excelforum.com/member.php...o&userid=13622
View this thread: http://www.excelforum.com/showthread...hreadid=391859





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename a sheet


hehe, Shortly after i made my final post i checked a computer with th
problem, you were correct in that the sheet in question was hidden.
had forgotten about that. Thanks for your help

Jaso

--
greenfalco
-----------------------------------------------------------------------
greenfalcon's Profile: http://www.excelforum.com/member.php...fo&userid=1362
View this thread: http://www.excelforum.com/showthread.php?threadid=39185

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
macro to: Add new sheet, then rename new sheet with todays date Paul Excel Worksheet Functions 3 September 29th 07 03:17 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 Sheet Linda@VZ Excel Discussion (Misc queries) 1 November 2nd 05 12:43 PM
Button to copy sheet, rename sheet sequencially. foxgguy2005[_3_] Excel Programming 9 June 17th 05 01:41 PM


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