litestream
Active Member
- Joined
- Jul 24, 2006
- Messages
- 323
Is it possible to make a user form just appear on a certain worksheet, rather than have it appear on all sheets of the workbook?
if activesheet.name <> "TheSheetIWanttobebehind" then
msgbox("Can't call this form from this sheet!")
unload me
end if
Private Sub CommandButton20_Click()
UserForm2.Show vbModeless
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name <> "YourSheetGoesHere" And UserForm2.Visible = True Then
Unload UserForm2
End If
If Sh.Name = "YourSheetGoesHere" And Userform2.Visible = False Then
UserForm2.show
End If
End Sub
If Sh.Name = "YourSheetGoesHere" And Userform2.Visible = False Then
UserForm2.show
End If