You need to tell you macro which state your form is in. The trouble is that because the macro is triggered when you select the sheet (either unhide it, or select it), then it is always in the same state as 'unhidden', so you can't use this property as a test. You need to create a new test for this state prior to running the macro. One way to do this is declare a static variable globally up front, then change the state in your code as you change the window state.
Add this line outside of any existing procedure in any module
public MySheetHidden As Boolean
add this to the workbook sheet module
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Sheets("sheet1").Visible = True Then Sheets("sheet1").Visible = False
End Sub
Private Sub Workbook_Open()
MySheetHidden = True
End Sub
Change the code on the sheet 1 module to
Private Sub Worksheet_Activate()
If MySheetHidden = True Then UserForm1.Show
End Sub
After every line of code where you have hidden/unhidden the sheet, you need to add another line that updates your variable
either MySheetHidden = True or MySheetHidden = False
You will need to debug this to make sure it works, as I haven't tested it
Bookmarks