Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Switching between spreadsheets

Final thing today...

I want to switch between worksheets in a macro, however, they will be
called slightly different things each time... each week it will be +1
last week... e.g. 'Week1Worksheet' will next week be
'Week2Worksheet' etc. (The number is the only thing that will be
different the text will be constant)- Is there a way to select the
sheet I want so I can switch between?
Help on this would be SO much appreciated.

Thanks

Solomon

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Switching between spreadsheets

Using code that actually selects sheets is best avoided since it considerably
slows down execution.

However,

If you define a variable such as

Dim WeekNum as integer

then

Sheets("Week" & WeekNum & "Worksheet").Select

will have the effect you desire.

A loop of some kind may be useful to you using WeekNum as the index.

Nick Shinkins






"solomon_monkey" wrote:

Final thing today...

I want to switch between worksheets in a macro, however, they will be
called slightly different things each time... each week it will be +1
last week... e.g. 'Week1Worksheet' will next week be
'Week2Worksheet' etc. (The number is the only thing that will be
different the text will be constant)- Is there a way to select the
sheet I want so I can switch between?
Help on this would be SO much appreciated.

Thanks

Solomon


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Switching between spreadsheets

If lastweek is the activesheet and the new sheet is the next in tab order:

Dim sh as Worksheet, sh1 as Worksheet
set sh = Activesheet
set sh1 = Activesheet.Next
msgbox sh.Name & " " & sh1.Name
Sh1.Range("A1").Value = sh.range("A1").Value


--
Regards,
Tom Ogilvy


"solomon_monkey" wrote in message
oups.com...
Final thing today...

I want to switch between worksheets in a macro, however, they will be
called slightly different things each time... each week it will be +1
last week... e.g. 'Week1Worksheet' will next week be
'Week2Worksheet' etc. (The number is the only thing that will be
different the text will be constant)- Is there a way to select the
sheet I want so I can switch between?
Help on this would be SO much appreciated.

Thanks

Solomon



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
Switching between workbooks Jim Excel Discussion (Misc queries) 5 July 28th 07 03:19 AM
Switching tabs Gor_yee Excel Discussion (Misc queries) 1 February 15th 07 10:57 AM
Lists Switching Yaroslav Excel Discussion (Misc queries) 2 August 22nd 06 08:30 AM
Can Excel Spreadsheets be saved as Microsoft Works spreadsheets? EXCEL WORKS CONFUSED Excel Discussion (Misc queries) 4 August 18th 06 11:21 PM
Switching from Quattro Pro Michael Gula New Users to Excel 2 February 19th 05 03:19 AM


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