ActiveSheet (IF statement)

H

hmaze

All:

I have a form that needs to appear after a togglebutton has been activated
on sheet1 and the user clicks on sheet2. I need the form to appear on
sheet2. (if toggle not clicked and user goes to sheet2, form should not
appear). I tried this on sheet1 but it's not correct:
If ToggleButton1.Value = True And ActiveSheet = Sheet2 Then UserForm1.Show

Can anyone provide some assistance - thank you.
 
J

JLGWhiz

How about a Worksheet_Activate event in the Sheet2 code module that checks
toggle button 1 for true and then call the form?
 
J

JLGWhiz

Assumes that ToggleButton1 is located on Sheet1.

Private Sub Worksheet_Activate()
If Sheets(1).ToggleButton1 = True Then
UserForm1.Show
End If
End Sub
 
J

JLGWhiz

sorry about the omission.

Private Sub Worksheet_Activate()
If Sheets(1).ToggleButton1.Value = True Then
UserForm1.Show
End If
End Sub
 
H

hmaze

That's it - thank you!

JLGWhiz said:
sorry about the omission.

Private Sub Worksheet_Activate()
If Sheets(1).ToggleButton1.Value = True 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