-
How to return to the previously viewed worksheet?
I want to be able to return to the worksheet I was looking at when I activate coding that takes me away from the currently viewed worksheet. I tried this, but it is now working. Anyone know how to fix this?
Code:
'in ThisWorkbook
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Set LstSht = Sh End Sub
'in Standard Module
Public LstSht As Worksheet
Sub GoToLast() LstSht.Activate
End Sub
-
If you want to use the same variable in a different module, I think you'll have to set it as public.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules