speaking about listboxes

mortgageman

Well-known Member
Joined
Jun 30, 2005
Messages
2,015
After the following line of code is executed, my listbox doesn't "grey out". It is locked for sure - I can't change what is selected - but shouldn't it grey out?

ListBoxLevel.Enabled = False

Gene, "The Mortgage Man", Klein
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
mortgageman said:
but shouldn't it grey out?
Hello again Gene,
No, your code will disable the listbox, but it doesn't change its appearance.

What you want to focus on is the BackColor property.
For example this will disable it and change the color to the same as your scrollbars...
Code:
ListBoxLevel.BackColor = &H80000000
ListBoxLevel.Enabled = False
And then you'll have to change it back at some point to being white (or whatever color your window background is) by using something like this.
Code:
ListBoxLevel.BackColor = &H80000005
ListBoxLevel.Enabled = False
You can check out the BackColor property to see what colors are available and get the code "numbers" for each color from there. (Make sure to look at the pallette colors too...)

Dan
 
Upvote 0

Forum statistics

Threads
1,207,198
Messages
6,077,018
Members
446,250
Latest member
Dontcomehereoften

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