+ Reply to Thread
Results 1 to 2 of 2

Return to Current Sheet in On (sheet activate) event macro

  1. #1
    Paul Moles
    Guest

    Return to Current Sheet in On (sheet activate) event macro

    I have a multi sheet workbook with an on event (sheet activate) macro.

    I want to go to a fixed sheet perform a seperate macro and then to return to
    the current sheet. Each time a sheet is activated.

    Do I need to get the current address in some way and then enter this or is
    there a "return here" function?

    Many Thanks

    Paul Moles



  2. #2
    Bob Phillips
    Guest

    Re: Return to Current Sheet in On (sheet activate) event macro

    Paul,

    No automatic return, so you have to save the exited sheet somewhere.

    This might get you started

    Private PrevSheet As String

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    MsgBox PrevSheet
    End Sub

    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    PrevSheet = Sh.Name
    End Sub


    'This is workbook event code.
    'To input this code, right click on the Excel icon on the worksheet
    '(or next to the File menu if you maximise your workbooks),
    'select View Code from the menu, and paste the code


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Paul Moles" <PaulMoles@discussions.microsoft.com> wrote in message
    news:2CF7E402-F4A3-43E6-A938-EBF4F46E25CB@microsoft.com...
    > I have a multi sheet workbook with an on event (sheet activate) macro.
    >
    > I want to go to a fixed sheet perform a seperate macro and then to return

    to
    > the current sheet. Each time a sheet is activated.
    >
    > Do I need to get the current address in some way and then enter this or is
    > there a "return here" function?
    >
    > Many Thanks
    >
    > Paul Moles
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1