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

  • Thread starter Thread starter tango
  • Start date Start date
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???
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top