List Box - not able to scroll to last item

Russell Hauf

MrExcel MVP
Joined
Feb 10, 2002
Messages
1,611
I have a list box that I'm filling dynamically (depends on the file being opened, there could be 1 item and there could be up to 100). When I'm done adding items, etc., I'm not able to scroll to the last item. The microsoft link below does not satisfy what I want to do. I don't want the list box to be as long as the list - I'm fine with the user scrolling to find what they want.

Here's what I've tried so far:

  • Setting the height to smaller than I want, then back to the height I really want
  • Setting the height to larger than the list, then back to my desired height (when I turn screenupdating on, I can see the last item when the list is made very tall - but it disappears once the height is set smaller again).
  • Adding another item then deleting it

None of these has worked. I am using fixed numbers to set the height (this refers to the link below).

Any suggestions?

-Russell

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q211696
This message was edited by Russell Hauf on 2002-05-07 15:14
This message was edited by Russell Hauf on 2002-05-07 15:14
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Just a wild stab...can you add a blank as the last item, or even something like --- and see if that shows up?

It may not show up and the last item you really want does. If this shows up and the real last item doesn't there are some referencing issues. If all show up, you may need to handle if the user selects the --- item.

Bye,
Jay

EDIT: Disregard this, as I didn't see item 3 in what you've tried already. Sorry.
This message was edited by Jay Petrulis on 2002-05-07 16:51
 
Upvote 0
On 2002-05-07 15:13, Russell Hauf wrote:
I have a list box that I'm filling dynamically (depends on the file being opened, there could be 1 item and there could be up to 100).Hauf on 2002-05-07 15:14 ]</font>

What do you mean by "depends on the file being opened"

and, what's your dynamic formula ?

everything else looks cast-iron kosher : but these two look potentially suspect...

:)
 
Upvote 0
No formula, through code. Everything works but scrolling to the last row. What I've done is to add an extra item in my ListBox (that won't be seen), and coded around it. It works, but I'd still like to know how to fix this obvious bug.
 
Upvote 0
very annoying bug this, i too would be keen to see some code to side step it if anyone has managed to do so.
 
Upvote 0
Figured out a fix...

I know this is an old post, but I was having this same problem and figure out a fix. Simply change the text alignment of the listbox. Voila. You can now scroll to the bottom and see the last item. You can change it back and it seems to remain fixed. Just thought I'd post it as I could not find a fix posted anywhere.
 
Upvote 0
Integral Height = True is the fix

Hi all,

I'm having the same problem... but figured it out!

flash281... changing the text alignment doesn't seem to work for me.
Besides, then I can't have the text aligned to the left.

What you need to do it change the 'Integral Height' field to true.
This may and probably will change the size of your listbox, but you'll always be able to see the last item in the box.

Happy exceling!
s_c
 
Upvote 0
Just one more pecision. The integralheight property first needs to be set to False, then add items to your listbox and then set integralheight = true.

This has done it for me :)!

Hope this helps.

DarthVador
 
Upvote 0
This was a very useful post. Thanks! I was having the same issues (font size changed when listbox was reloaded) and users couldn't scrool down to last list item if list went beyond box.

Changing the listbox's IntegralHeight setting to TRUE, filling list using code, and then changing setting to TRUE fixed *both* of these very annoying issues.
 
Upvote 0
UPDATE: Well, actually this code did NOT fix the font increasing problem. It returned soon after when doing more testing.

However, I found that while troubleshooting if I put a break on the code after I fill the listbox, then ran through until the end the listbox font was fine. This led me to put a brief (< 1 second) pause in the code at the end of my WITH statement and for now it seems to be working.

Maybe this is an issue with the PC's processor?

Application.Wait (Now + TimeValue("0:00:01") * .5)
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,916
Members
448,533
Latest member
thietbibeboiwasaco

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