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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
The combo box is called 'Examining Company'

Number of columns - 2
The bound column is 1
Data 1, "CGS"
Data 2, "Entyrety"
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,980
Members
448,934
Latest member
audette89

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
Back
Top