Hide or show a control depending on selection made

Hozz

Board Regular
Joined
Feb 10, 2005
Messages
140
Hello,

I have a tickbox on a form that relates to only one selection from a drop down box. I want the tickbox to be hidden unless I make the appropriate selection from the dropdown.

How do I do this?
 

Some videos you may like

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

pritcham

Board Regular
Joined
Oct 26, 2005
Messages
128
Hi

Firstly change the "Visible" property of the checkbox to default to FALSE. Then on the "OnChange" event of the combo box add something like the following:

If MyCombo = 3 Then MyCheckbox.Visible = True Else MyCheckboxl.Visible = FALSE

(Where the 3 above is the value you're checking for)

cheers
Martin
 

Hozz

Board Regular
Joined
Feb 10, 2005
Messages
140
I've tried as you suggested.

This is my line of code...

If examining_company = 1 Then rons_tick.Visible = True Else rons_tick.Visible = False

I've set rons_tick (the checkbox) visible to No.

But it doesn't change. It stays invisible.

I tried changing the 1 to CGS as that is the value. That didn't make a differance. I tried putting the line of code into the after update section, that didn't work either.

What am I doing wrong?
 

pritcham

Board Regular
Joined
Oct 26, 2005
Messages
128
Hi

What's your combo box called. And what values are stored in it. Do you have a bound column - if so, what is it and what values does it hold (i.e.

Number of cols: 2
Bound col: 1
Data:
1, "First company"
2, "Second company"
3, "Third etc etc"

Martin
 

Hozz

Board Regular
Joined
Feb 10, 2005
Messages
140
The combo box is called 'Examining Company'

Number of columns - 2
The bound column is 1
Data 1, "CGS"
Data 2, "Entyrety"
 

pritcham

Board Regular
Joined
Oct 26, 2005
Messages
128
OK - just to check what the combo box is reporting as being selected add the following to the OnChange event:

Msgbox me.examining_company

What appears in the msgbox when you select a) the company where you want the checkbox to be displayed, and b) for any other company?

Martin
 

Watch MrExcel Video

Forum statistics

Threads
1,118,539
Messages
5,572,786
Members
412,484
Latest member
deezina07
Top