View Single Post
 
Old 09-28-2022, 06:59 AM
Marcia's Avatar
Marcia Marcia is offline Windows 11 Office 2021
Expert
 
Join Date: May 2018
Location: Philippines
Posts: 553
Marcia has a spectacular aura aboutMarcia has a spectacular aura aboutMarcia has a spectacular aura about
Default Message Box vba when a sheet is activated

Hi. I copied this code from Ablebits that gives me the right message when Sheet X is selected. How do I add to the code that if Sheet X or Y or Z is selected, the same message box pops up?
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    On Error Resume Next
    If Sh.Name = "Sheet X" Then
        MsgBox "Print Form 2307", vbInformation, "Print 2307 Message"
    End If
End Sub
Thank you.

Last edited by Marcia; 09-28-2022 at 03:33 PM. Reason: typo
Reply With Quote