Unexpected changes to Listbox height

PickingUp

New Member
Joined
Jan 11, 2012
Messages
8
I'm using VBA code in Excel 2003 and I set the height of a listbox at runtime. Unfortunately, the end result is different than what I programmed it to be.
A bit of debugging (stepping through line by line and watching the Locals window) reveals that the code in fact does initially set the height to the desired number. But each time the code sets another property of the listbox (RowSource, ColumnWidth, Font size) the height changes unexpectedly.
Any ideas?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
"If IntegralHeight is True, the list box automatically resizes when necessary to show full rows. If False, the list remains a fixed size; if items are taller than the available space in the list, the entire item is not shown. "
 
Upvote 0
:) It worked! Thanks a lot!

I would still like to know why it should make a difference. I mean, the Font size could affect the balance of the height, but how would RowSource or ColumnWidth cause a change in integral height?

Puzzled in New Jersey
 
Upvote 0
:) It worked! Thanks a lot!

I would still like to know why it should make a difference. I mean, the Font size could affect the balance of the height, but how would RowSource or ColumnWidth cause a change in integral height?

Puzzled in New Jersey
Does the height adjust itself more than once when these properties are changed, or just once?
 
Upvote 0
The code changed the RowSource. The Height changed.
The code changed the ColumnWidths. The Height changed again.
The code changed the Font Size. The Height changed a third time.

The problem you've already solved. Just it would be nice to understand what was happening and you never know when such knowledge could come in handy. But I don't want to trouble anyone to break their heads on a theoretical problem.
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,399
Members
448,957
Latest member
Hat4Life

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