activate userform when a worksheet tab is selected

  • Thread starter Thread starter James
  • Start date Start date
J

James

Hello,

How do I automatically activate a userform when a user selects a specific
worksheet tab? What's the code for that?

Thank you
 
Place code on the Workbook code page

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name = "Sheet1" Then
UserForm1.Show
End If
End Sub
 
Back
Top