ListBox Questions

AndrewKent

Well-known Member
Joined
Jul 26, 2006
Messages
889
Following on from my previous thread about getting a ListBox selection to populate into a cell, I have a few more questions about how a ListBox functions.

The data that appears in my ListBox needs to be variable based on the amount of rows that are populated (the data's being pulled back from Access). I have a formula setup within a defined range however this doesn't work if NO data is pulled back (and this the ListBox would be empty). The formula I'm using is this...

=OFFSET('Search Engine'!$E$4,1,0,SUM(COUNTA('Search Engine'!$E:$E),1)-1,6)

...does anyone have a good formula for a variable range row source for a list box?

also, is there any way to change the colour of the selected row from that horrible grey to something else?

...and finally...

I need to set the column widths so that they are only as wide as the longest data in the column. Is this possible?

Andy
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You can use code rather than a DNR to populate the list, or you could specify at least one row:
=OFFSET('Search Engine'!$E$4,1,0,MAX(COUNTA('Search Engine'!$E:$E)-1,1),6)
The selected row is generally blue by default in my experience - it's tied into the Windows colour scheme.
The third part is more trouble than it's worth to my mind.
 
Upvote 0
Thanks, Shame about the defaul colour (I have a specific colour scheme from the program I'm writing) but it's not a biggie. Thanks again though!
 
Upvote 0
I should add that you can fudge the column width thing as long as you use a fixed width font.
 
Upvote 0

Forum statistics

Threads
1,214,583
Messages
6,120,383
Members
448,956
Latest member
JPav

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