Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default check/uncheck a checkbox


Hi,

I have two checkboxes on a userform in Excel, "Yes" and "No".
When the userform is opened the checkboxes are both unchecked.
When the "Yes" checkbox is checked and I then check the "No" checkbox,
the "Yes" checkbox should be unchecked again.
When the "No" checkbox is checked and I then check the "Yes" checkbox,
the "No" checkbox should be unchecked again.
I have some code below, but it doesn't work.
Can someone help me solve this problem? Thanks in advance!


Code:
--------------------
Private Sub CheckBox1_Click()

CheckBox1.Value = True
CheckBox2.Value = False

End Sub
--------------------

-------------------------------------------------------------------------

Code:
--------------------
Private Sub CheckBox2_Click()

CheckBox2.Value = True
CheckBox1.Value = False

End Sub
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=558793

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default check/uncheck a checkbox


You'd be better off using OptionButtons rather than CheckBoxes - they'r
mutually exclusive by design so when you click one the other i
deactivated.

Co

--
colofnatur
-----------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...fo&userid=3435
View this thread: http://www.excelforum.com/showthread.php?threadid=55879

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default check/uncheck a checkbox

leonidas wrote:
Hi,

I have two checkboxes on a userform in Excel, "Yes" and "No".
When the userform is opened the checkboxes are both unchecked.
When the "Yes" checkbox is checked and I then check the "No" checkbox,
the "Yes" checkbox should be unchecked again.
When the "No" checkbox is checked and I then check the "Yes" checkbox,
the "No" checkbox should be unchecked again.
I have some code below, but it doesn't work.
Can someone help me solve this problem? Thanks in advance!


Code:
--------------------
Private Sub CheckBox1_Click()

CheckBox1.Value = True
CheckBox2.Value = False

End Sub
--------------------

-------------------------------------------------------------------------

Code:
--------------------
Private Sub CheckBox2_Click()

CheckBox2.Value = True
CheckBox1.Value = False

End Sub
--------------------


Why not change them to radio buttons, they do this naturally.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default check/uncheck a checkbox


Hi Col,

Thanks for the advice! I will use optionbuttons instead!


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=558793

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
check or uncheck a check box based on a cell value RTKCPA Excel Discussion (Misc queries) 1 February 3rd 10 03:11 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
Check and uncheck a checkbox NoProgram Excel Programming 3 April 25th 06 10:44 PM
How do I check/uncheck ten or odd Checkboxes by click on one check Ken Vo Excel Discussion (Misc queries) 5 January 4th 06 11:10 PM
Check / Uncheck Box Navy Chief Setting up and Configuration of Excel 1 October 3rd 05 01:54 AM


All times are GMT +1. The time now is 10:10 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"