Consulting

Results 1 to 3 of 3

Thread: How to return to the previously viewed worksheet?

  1. #1
    VBAX Newbie
    Joined
    Nov 2013
    Posts
    2
    Location

    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

  2. #2
    If you want to use the same variable in a different module, I think you'll have to set it as public.

  3. #3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •