activate userform when a worksheet tab is selected

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
 
N

Nigel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top