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


Thanks for responding Deepak Agarwal


Basically, to select say sheet 3 in a macro I would write:

Sheets("Sheet3").Select

But say the sheet number is actually a variable called 'Count'.

I need to be able to select the sheet of number 'Count'.
ie. If 'Count' = 5, then I need a macro that selects sheet 5.

Hope this makes more sense,

Thanks for your help,

Mik

--
mikey1
-----------------------------------------------------------------------
mikey10's Profile: http://www.excelforum.com/member.php...fo&userid=1537
View this thread: http://www.excelforum.com/showthread.php?threadid=27008

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Sheet number variable

Have you tried:

Sheets(Count).Select

Count must be an integer, greater than or equal to 1 and less then or equal
to activeworkbook.sheets.count

"mikey10" wrote:


Thanks for responding Deepak Agarwal


Basically, to select say sheet 3 in a macro I would write:

Sheets("Sheet3").Select

But say the sheet number is actually a variable called 'Count'.

I need to be able to select the sheet of number 'Count'.
ie. If 'Count' = 5, then I need a macro that selects sheet 5.

Hope this makes more sense,

Thanks for your help,

Mike


--
mikey10
------------------------------------------------------------------------
mikey10's Profile: http://www.excelforum.com/member.php...o&userid=15378
View this thread: http://www.excelforum.com/showthread...hreadid=270084


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sheet number variable


Hi

I think I am getting at what you are after!

Try this :-

Presuming that the variable containing the desired sheet number i
'Count' and the value of 'Count' now is say 3 - hence your macro shoul
select the 3rd worksheet in your workbook an name it as 'Week3', the
this would perhaps help :-

Worksheets(Count).select
activesheet.name = "Week" & Count


This will select the 3rd worksheet in the workbook starting from th
first worksheet beginning from left.

See if this helps - otherwise let me know and I will see if I can offe
further assitance.


Best regards


Deepak Agarwa

--
agarwaldv
-----------------------------------------------------------------------
agarwaldvk's Profile: http://www.excelforum.com/member.php...fo&userid=1134
View this thread: http://www.excelforum.com/showthread.php?threadid=27008

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 To make a sheet reference Variable (eq: sum(sheet!D2:H2)) John Linker Excel Discussion (Misc queries) 3 June 16th 08 11:29 PM
Variable sheet and Formula Sheet Emmett423 Excel Discussion (Misc queries) 2 March 31st 06 02:14 AM
variable in a link where the variable is the name of the sheet darrelly Excel Worksheet Functions 1 October 7th 05 08:24 AM
Sheet number variable mikey10[_4_] Excel Programming 2 October 18th 04 11:43 AM
Using a variable as a Row number Phil Hennessy Excel Programming 3 August 6th 04 05:56 PM


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