Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Switching between workbooks | Excel Discussion (Misc queries) | |||
Switching tabs | Excel Discussion (Misc queries) | |||
Lists Switching | Excel Discussion (Misc queries) | |||
Can Excel Spreadsheets be saved as Microsoft Works spreadsheets? | Excel Discussion (Misc queries) | |||
Switching from Quattro Pro | New Users to Excel |