ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move to a named worksheet from any worksheet in the same workbook (https://www.excelbanter.com/excel-programming/421066-move-named-worksheet-any-worksheet-same-workbook.html)

tango

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

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???

Simon Lloyd[_948_]

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


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)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=38920


Hong Quach

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

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

"tango" wrote:

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???



All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com