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?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,809
Messages
5,833,790
Members
430,233
Latest member
cbutts

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top