LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Scrolling in a form's listbox

Hey guys, I'd really appreciate your help!

I have a listbox on a userform that gets populated with a number of
"rows" based on the user's selections in a previous form. Because the
listbox has ten columns and the scrollbar is waaay off to the right, I
wanted to add a second scroll bar on the form, just to the left of the
listbox. When the scroll bar is used, the listbox will scroll up and
down.

I think I've figured out how to get from the scrollbar how many rows
the user wants to move up or down ... but I have no idea how to
"scroll" the listbox! I've attached the code I'm using below:

Private Sub ScrollBar1_Change()
'Declarations
Dim iCounter As Integer
'Scroll only if listbox is not empty
If frmRecordsResult.ListBox1.ListCount 0 Then
'unselect all, select chosen.
For iCounter = 0 To frmRecordsResult.ListBox1.ListCount - 1
If iCounter = ScrollBar1.Value Then
frmRecordsResult.ListBox1.Selected(iCounter) = True
Else
frmRecordsResult.ListBox1.Selected(iCounter) = False
End If
Next iCounter
'scroll in listbox
frmRecordsResult.ListBox1.TabIndex =
Application.WorksheetFunction.Max(ScrollBar1.Value , 1) - 1

frmRecordsResult.ListBox1.Selected(Application.Wor ksheetFunction.Max(ScrollBar1.Value,
1) - 1) = True
'ADD A LINE TELLING THE LISTBOX TO "SCROLL" HERE
End If
End Sub

Thanks for any help!

Chris
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrolling error in listbox on Vista ssmith Excel Programming 0 November 27th 07 08:03 PM
How to get a listbox to move when scrolling down spreadsheet kdunnSBLI Excel Discussion (Misc queries) 1 June 24th 05 12:31 AM
Want listbox to move when scrolling down spreadsheet kdunnSBLI Excel Discussion (Misc queries) 3 June 23rd 05 11:11 PM
ListBox Scrolling in VBA Kevin Excel Programming 4 July 7th 04 10:27 PM
listbox scrolling with mouse Graham[_4_] Excel Programming 4 December 11th 03 05:58 PM


All times are GMT +1. The time now is 08:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"