ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to make listbox show the last item being added? (https://www.excelbanter.com/excel-programming/338662-how-make-listbox-show-last-item-being-added.html)

Ai_Jun_Zhang[_6_]

How to make listbox show the last item being added?
 

Hi!

I have a list box in a form and it shows the running status. Fo
example,
many status are added to the list box as

lstStatus.AddItem Doing action 1
lstStatus.AddItem Doing action 2
lstStatus.AddItem Doing action 3
lstStatus.AddItem Doing action 4
lstStatus.AddItem Doing action 5
lstStatus.AddItem Doing action 6
...
...

so on.

As more actions are added to the list box, the list box does no
automatically scroll down to show the latest one and user can only se
the first few ones that fit into the height of the list box.

My question is: how to make list box automatically scroll down to sho
the last item that is added to the list box.?

Please advise.

Aijun

--
Ai_Jun_Zhan
-----------------------------------------------------------------------
Ai_Jun_Zhang's Profile: http://www.excelforum.com/member.php...fo&userid=2547
View this thread: http://www.excelforum.com/showthread.php?threadid=40017


Robin Hammond[_2_]

How to make listbox show the last item being added?
 
Aijun,

It should be something like

lstStatus.AddItem "Doing action 6"
lstStatus.Listindex = lstStatus.Listcount-1

Robin Hammond
www.enhanceddatasystems.com

"Ai_Jun_Zhang"
wrote in message
news:Ai_Jun_Zhang.1ujnmd_1125349557.8293@excelforu m-nospam.com...

Hi!

I have a list box in a form and it shows the running status. For
example,
many status are added to the list box as

lstStatus.AddItem Doing action 1
lstStatus.AddItem Doing action 2
lstStatus.AddItem Doing action 3
lstStatus.AddItem Doing action 4
lstStatus.AddItem Doing action 5
lstStatus.AddItem Doing action 6
..
..

so on.

As more actions are added to the list box, the list box does not
automatically scroll down to show the latest one and user can only see
the first few ones that fit into the height of the list box.

My question is: how to make list box automatically scroll down to show
the last item that is added to the list box.?

Please advise.

Aijun.


--
Ai_Jun_Zhang
------------------------------------------------------------------------
Ai_Jun_Zhang's Profile:
http://www.excelforum.com/member.php...o&userid=25474
View this thread: http://www.excelforum.com/showthread...hreadid=400178




Ai_Jun_Zhang[_9_]

How to make listbox show the last item being added?
 

Robin,

Thank you very much for the code. It works great!

Aijun

--
Ai_Jun_Zhan
-----------------------------------------------------------------------
Ai_Jun_Zhang's Profile: http://www.excelforum.com/member.php...fo&userid=2547
View this thread: http://www.excelforum.com/showthread.php?threadid=40017



All times are GMT +1. The time now is 08:19 PM.

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