ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Go back to previous page (https://www.excelbanter.com/excel-programming/378802-re-go-back-previous-page.html)

Gary''s Student

Go back to previous page
 
If by page you mean tab or worksheet, then in a standard module enter:

Public neew As Range
Public old As Range

Sub goback()
old.Parent.Activate
End Sub

Sub init()
Set neew = Selection
End Sub

and in each worksheet enter:

Private Sub Worksheet_Activate()
Set old = neew
Set neew = Selection
End Sub

First run init(), then move from tab to tab all you like. Run goback() to
get back to the previous tab.
--
Gary's Student


"jweasl" wrote:

I need a macro that will take me back to the page I was previously on. I have
about 30 pages total, and you often move from one to the next in no
particular order. Many times I will run macros on the page before needing to
go back as well.



All times are GMT +1. The time now is 10:19 AM.

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