View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Setting Default of Checkbox based on value of combobox


--
When you lose your mind, you free your life.


"Lost!" wrote:


I have a combobox that is a drop-down menu on one userform. Another
userform on the sheet is made up only of checkboxes. I want the default
for one of the checkboxes to be determined by the combobox. If one
option, "RCP", is selected, I want the checkbox default to be true. If
any of the other options are selected for the combobox, I want the
default to be false. Here's the code I was using:


Range("h17").Select 'H17 is where the combobox results are
displayed
If ActiveCell.Value = rcp Then
cbx3099 = True
Else: cbx3099 = False
End If


I have this in the initialize sub for the checkbox userform. I tried
putting RCP in quotes, but it made no difference.

Thanks!


--
Lost!
------------------------------------------------------------------------
Lost!'s Profile: http://www.excelforum.com/member.php...o&userid=23990
View this thread: http://www.excelforum.com/showthread...hreadid=377808



A couple of points, FIrst where is this code at? is it in a Regular module
or in an object module? (Sheet1 Sheet2 ThisWorkbook, etc...)

If in a regular Module you must tell VBA where to find the check box

also capitolize rcp

use the following


Range("h17").Select 'H17 is where the combobox results are displayed
If ActiveCell.Value = "RCP" Then
sheet1.cbx3099 = True
Else: sheet1.cbx3099 = False
End If

if the checkbox is on a different sheet use the correct sheet number for
instance
sheet2.cbx3099
sheet3.cbx3099