Close Worksheet Event

  • Re: Close Worksheet Event


    use this in thisworkbook module


    Code
    Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
        MsgBox Prompt:="You just left sheet:" & Sh.Name
    End Sub
  • Re: Close Worksheet Event


    Just noticed, you said to put it in ThisWorkbook, sorry about that. How would I run a macro leaving a only a specific worksheet, Sheet5 (AllOrders), not every worksheet? When in ThisWorkbook it runs when I exit every worksheet.

  • Re: Close Worksheet Event


    Put this If statement, all seems good, thanks.

    Code
    If Sh.Name = "AllOrders" Then
        MsgBox Prompt:="You just left sheet:" & Sh.Name
        End If

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!