ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Grey out listbox in userform (https://www.excelbanter.com/excel-programming/386487-grey-out-listbox-userform.html)

ExcelMonkey

Grey out listbox in userform
 
I have a userform. I want to prohibit the user from one of the listboxes at
certain times. I know I can set the .Enabled propterty = False. But how to
you grey out the listbox?

Thanks

EM

JLGWhiz

Grey out listbox in userform
 
Maybe hiding it would work better.

ListBox1.Hide

If they can't see it they can't use it.
"ExcelMonkey" wrote:

I have a userform. I want to prohibit the user from one of the listboxes at
certain times. I know I can set the .Enabled propterty = False. But how to
you grey out the listbox?

Thanks

EM


JLGWhiz

Grey out listbox in userform
 
Sorry, Hide is for the whole UserForm

ListBox1.Visible = False

Would hide the control.


"ExcelMonkey" wrote:

I have a userform. I want to prohibit the user from one of the listboxes at
certain times. I know I can set the .Enabled propterty = False. But how to
you grey out the listbox?

Thanks

EM


Tim Williams

Grey out listbox in userform
 
.... and maybe you could then display a label with the listbox value instead.

--
Tim Williams
Palo Alto, CA


"JLGWhiz" wrote in message ...
Sorry, Hide is for the whole UserForm

ListBox1.Visible = False

Would hide the control.


"ExcelMonkey" wrote:

I have a userform. I want to prohibit the user from one of the listboxes at
certain times. I know I can set the .Enabled propterty = False. But how to
you grey out the listbox?

Thanks

EM




Andy Pope

Grey out listbox in userform
 
Hi,

Try changing the forecolor to give a visual clue to the listbox's state.

If ListBox1.Enabled Then
ListBox1.ForeColor = SystemColorConstants.vbWindowText
Else
ListBox1.ForeColor = SystemColorConstants.vbGrayText
End If

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"ExcelMonkey" wrote in message
...
I have a userform. I want to prohibit the user from one of the listboxes
at
certain times. I know I can set the .Enabled propterty = False. But how
to
you grey out the listbox?

Thanks

EM




All times are GMT +1. The time now is 03:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com