Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home

"grayed out" options on userform...

Posted by rm on December 30, 2001 7:58 PM
Hello,

I have put a userform in my workbook that allows a user opening it to enter new information on a worksheet via the userform. I would like to know how to have a certain section of that userform "grayed out" (user cannot select options), but made available based on certain selections made from a listbox on the form.

Example: In a drop-down list box a user will select from list "NRFT", "SEFT", and "MUPT". There are a set of optionbuttons on the userform which have been put within a frame. I would like the optionbuttons located within that frame grayed out by default (user can't input anything). But if user selects "SEFT" from the list box, then the area is no longer grayed out, and optionbuttons are now able to select--(because this section is only relevant to "SEFT", but not the other options). Hope this made sense...thanks...rm


Check out our Excel VBA Resources

Re: "grayed out" 2 methods

Posted by Tom Dickinson on December 30, 2001 8:22 PM
Two different methods:

Turn the "Locked" property to "TRUE". This will keep the object visable, but not allow any interaction.

The other method would be to turn the object property "Visible" to "FALSE". This will hide the object entirely (which may help in minimizing a user's confusion).

You can turn these on or off at the time a selection is made (ListBox1_Change), but don't forget to reverse the action (like when the listbox is re-entered).


...thank you Tom...but doesn't achieve what I wanted...

Posted by rm on December 30, 2001 9:05 PM
...happy new year...rm

Re: ...thank you Tom...but doesn't achieve what I wanted...

Posted by Ivan F Moala on December 30, 2001 9:12 PM

RM

you need to set the enabled property of the optionbox.....set this to false @ load time
or just by setting them to false by default
in you setup.
Then enable them when your condition is met eg

If ..... then Optionbox1.enabled = true

etc

Ivan


...thanks Ivan...

Posted by rm on December 31, 2001 6:27 PM
...that's the ticket...rm

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.