Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Scrolling error in listbox on Vista | Excel Programming | |||
How to get a listbox to move when scrolling down spreadsheet | Excel Discussion (Misc queries) | |||
Want listbox to move when scrolling down spreadsheet | Excel Discussion (Misc queries) | |||
ListBox Scrolling in VBA | Excel Programming | |||
listbox scrolling with mouse | Excel Programming |