Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default ActiveSheet (IF statement)

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default ActiveSheet (IF statement)

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

"hmaze" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default ActiveSheet (IF statement)

Assumes that ToggleButton1 is located on Sheet1.

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


"hmaze" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default ActiveSheet (IF statement)

sorry about the omission.

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


"hmaze" wrote:

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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default ActiveSheet (IF statement)

That's it - thank you!

"JLGWhiz" wrote:

sorry about the omission.

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


"hmaze" wrote:

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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Use a password in VBA ActiveSheet.protect & ActiveSheet.unprotect? Jim K. Excel Programming 2 June 2nd 08 08:09 PM
Copying new activesheet after other activesheet is hidden? Simon Lloyd[_790_] Excel Programming 1 June 20th 06 10:02 AM
Get ActiveSheet name in VB Geoff Lambert[_2_] Excel Programming 1 October 8th 04 02:25 PM
name of the activesheet rasta Excel Programming 1 October 3rd 03 09:49 PM
ActiveSheet.Name? Andrew Stedman Excel Programming 5 July 30th 03 01:17 PM


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"