Auto move scroll bars of listbox

J

JON JON

Dear Ng,

I had created a user form which is not modal that serves as splash screen
while my macro runs into the background. This userform includes a listbox
that is populated during runtime. My problem now is that when the entries
in the listbox exceed beyond it size, the latest entries are being hide in
view. Is there a way that I can move the scroll bars of the listbox so that
I can show the latest entries in view.

All help will be highly appreciated.

Regards,

Jon-jon
 
K

keepITcool

topindex demo...

Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)

Private Sub UserForm_activate()
Dim i%
With ListBox1
For i = 1 To 100
.AddItem "item" & Format(i, " 000")
If .ListCount > 5 Then
.TopIndex = .ListCount - 5
End If
Me.Repaint
Sleep 100
Next
End With
Unload Me
End Sub

--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Tom Ogilvy wrote :
 
J

JON JON

Keep ITcool,

Thank you very much it was a great help.

Can you please extend more help by explaining what does the "Sleep 100" do?
I am just really curious about it.

TIA,

Jon-jon
 
K

keepITcool

Jon, jon

similar as application.wait the Sleep function suspends the execution
of the current thread for a specified interval. This is a so called
windows API call.

the sleep is just for the demo to keep the loop slow enough to see it
move...



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


JON JON wrote :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top