Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Changing the visibility of Textbox/Label Based on Two Checkboxes

Hi,

I have a userform with two checkboxes. One I have named Yes and one I
have labeled No.

This is my code in the No Event procedure

UserForm2.Yes.Value = _
Not UserForm2.Yes.Value

This is my code in the Yes event procedure

UserForm2.No.Value = _
Not UserForm2.No.Value

It works perfectly. The problem is that I want to add code to change
the visibility of the textbox and label directly below it. When I try
what I have below, it screws everything up and the checkboxes don't
work correctly.

This is what I have in each of the event procedures right above the
above code I just displayed:

Yes_Click

Select Case UserForm2.Yes.Value
Case Is = "True"
UserForm2.SendToRepLabel.Visible = True
Case Is = "False"
UserForm2.SendToRepLabel.Visible = False
End Select

No_Click

Select Case UserForm2.Yes.Value
Case Is = "True"
UserForm2.SendToRepLabel.Visible = True
Case Is = "False"
UserForm2.SendToRepLabel.Visible = False
End Select


Any ideas what this is doing that is screwing up my checkboxes? I
mean, the select statements are not modifying the value of the
checkboxes, so why would it screw with their behavior?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Changing the visibility of Textbox/Label Based on Two Checkboxes

You are probably triggering each checkboxes click event from the other. Use
a boolean to control, like this


Private Sub Yes_Click()

If Not fReEntry Then

With Me

fReEntry = True

'your code

fReEntry = False
End With
End If

End Sub

--
__________________________________
HTH

Bob

"R Tanner" wrote in message
...
Hi,

I have a userform with two checkboxes. One I have named Yes and one I
have labeled No.

This is my code in the No Event procedure

UserForm2.Yes.Value = _
Not UserForm2.Yes.Value

This is my code in the Yes event procedure

UserForm2.No.Value = _
Not UserForm2.No.Value

It works perfectly. The problem is that I want to add code to change
the visibility of the textbox and label directly below it. When I try
what I have below, it screws everything up and the checkboxes don't
work correctly.

This is what I have in each of the event procedures right above the
above code I just displayed:

Yes_Click

Select Case UserForm2.Yes.Value
Case Is = "True"
UserForm2.SendToRepLabel.Visible = True
Case Is = "False"
UserForm2.SendToRepLabel.Visible = False
End Select

No_Click

Select Case UserForm2.Yes.Value
Case Is = "True"
UserForm2.SendToRepLabel.Visible = True
Case Is = "False"
UserForm2.SendToRepLabel.Visible = False
End Select


Any ideas what this is doing that is screwing up my checkboxes? I
mean, the select statements are not modifying the value of the
checkboxes, so why would it screw with their behavior?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Changing the visibility of Textbox/Label Based on Two Checkboxes

Forgot to say, fReEntry should be declared as module scope variable

Private fReEntry As Boolean

before any procedures

--
__________________________________
HTH

Bob

"R Tanner" wrote in message
...
Hi,

I have a userform with two checkboxes. One I have named Yes and one I
have labeled No.

This is my code in the No Event procedure

UserForm2.Yes.Value = _
Not UserForm2.Yes.Value

This is my code in the Yes event procedure

UserForm2.No.Value = _
Not UserForm2.No.Value

It works perfectly. The problem is that I want to add code to change
the visibility of the textbox and label directly below it. When I try
what I have below, it screws everything up and the checkboxes don't
work correctly.

This is what I have in each of the event procedures right above the
above code I just displayed:

Yes_Click

Select Case UserForm2.Yes.Value
Case Is = "True"
UserForm2.SendToRepLabel.Visible = True
Case Is = "False"
UserForm2.SendToRepLabel.Visible = False
End Select

No_Click

Select Case UserForm2.Yes.Value
Case Is = "True"
UserForm2.SendToRepLabel.Visible = True
Case Is = "False"
UserForm2.SendToRepLabel.Visible = False
End Select


Any ideas what this is doing that is screwing up my checkboxes? I
mean, the select statements are not modifying the value of the
checkboxes, so why would it screw with their behavior?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Changing the visibility of Textbox/Label Based on Two Checkboxes

On Oct 20, 3:24*pm, "Bob Phillips" wrote:
Forgot to say, fReEntry should be declared as module scope variable

Private fReEntry As Boolean

before any procedures

--
__________________________________
HTH

Bob

"R Tanner" wrote in message

...



Hi,


I have a userform with two checkboxes. One I have named Yes and one I
have labeled No.


This is my code in the No Event procedure


UserForm2.Yes.Value = _
* *Not UserForm2.Yes.Value


This is my code in the Yes event procedure


UserForm2.No.Value = _
* *Not UserForm2.No.Value


It works perfectly. *The problem is that I want to add code to change
the visibility of the textbox and label directly below it. *When I try
what I have below, it screws everything up and the checkboxes don't
work correctly.


This is what I have in each of the event procedures right above the
above code I just displayed:


Yes_Click


Select Case UserForm2.Yes.Value
* *Case Is = "True"
* * * *UserForm2.SendToRepLabel.Visible = True
* *Case Is = "False"
* * * *UserForm2.SendToRepLabel.Visible = False
End Select


No_Click


Select Case UserForm2.Yes.Value
* *Case Is = "True"
* * * *UserForm2.SendToRepLabel.Visible = True
* *Case Is = "False"
* * * *UserForm2.SendToRepLabel.Visible = False
End Select


Any ideas what this is doing that is screwing up my checkboxes? *I
mean, the select statements are not modifying the value of the
checkboxes, so why would it screw with their behavior?


Thanks- Hide quoted text -


- Show quoted text -


Okay thank you for the info...
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
Changing the font for part of an axis label, not the whole label. amy45 Charts and Charting in Excel 2 April 5th 23 01:11 PM
Reference Label from TextBox Stephen Newman[_2_] Excel Programming 7 July 20th 08 06:27 PM
Help: Multiple Checkboxes (, naming and visibility) Clinton M James[_2_] Excel Programming 3 March 6th 07 03:09 PM
Textbox text visibility bcelestia Excel Discussion (Misc queries) 2 January 11th 07 08:47 AM
Changing the textbox value without changing the textbox format? Ozgur Pars[_2_] Excel Programming 2 September 8th 06 06:41 AM


All times are GMT +1. The time now is 07:55 PM.

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

About Us

"It's about Microsoft Excel"