I am using a list box with two buttons. One button is to move down the list the other is to move up it. I am able to do this by changing the value of the cell link using vba code:
If Range("S6").value >1 then Range("S6").value = Range("S6").value - 1
This code works great to change the selection the problem is the list box does not scroll with the selection. I have tried using the TopIndex property of the ListBox but I can't figure out how to actually control the list box. I keep getting "object doesn't support this property or method" Error. Here is the code:
Sub PreviousButton_Click()
Dim CategoryListBox as Object
Set CategoryListBox = worksheets("Screened List").Shapes("List Box 2")
CategoryListBox.TopIndex = CategoryListBox.ListIndex
If Range("S6").value >1 then Range("S6").value = Range("S6").value - 1
End Sub
Bookmarks