Move to a named worksheet from any worksheet in the same workbook

T

tango

I five worksheets in this workbook. I want to start at worksheet Sample
whenever i open the file and when the macro is in other worksheet, i want it
to jump to worksheet Sample to access information and come back... how do i
do that???
 
S

Simon Lloyd

You need to be a little more specific, what macro do you have that runs
on the other sheet?, what does it do? what are you expecting to return
to the sheet you were on?


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 
H

Hong Quach

Hi tango,

To start at a particular ws ("Summary") when open the workbook, you will
need to add this code to "ThisWorkbook" VBA page.

Private Sub Workbook_Open()
Sheets("Summary").Select
End Sub

To have the macro remember the current ws, and then go to "Summary" ws to do
the works and finally switch back to current ws when done, you have to wrap
each of the macro with the following code:

Sub MacroA()
Dim currentWSName As String

currentWSName = ActiveSheet.Name ' Save the current Sheet
Sheets("Summary").Select ' Switch to Summary

' Your code starts ...
Application.Wait (Now() + TimeValue("00:00:03"))
' Your code ends ...

Sheets(currentWSName).Select ' Return to privous sheet
End Sub

Replace everything insid
Hong Quach
 
Top