Setting Default of Checkbox based on value of combobox

L

Lost!

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


Range("h17").Select 'H17 is where the combobox results ar
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 trie
putting RCP in quotes, but it made no difference.

Thanks
 
G

Guest

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


Lost! said:
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!

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
 

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