I currently have good code (below) that progressively moves the selected row in a Listbox (name: "List Box 301") down by 1 with each run of the macro.
I just added a second Listbox ("List Box 302"), and I want the code to be able to control either Listbox depending on a given cell's value. For example, if $BT$2 = 1, I want the code to control List Box 301. If $BT$2 = 2, I want it to control List Box 302.
Grateful for any help.
I just added a second Listbox ("List Box 302"), and I want the code to be able to control either Listbox depending on a given cell's value. For example, if $BT$2 = 1, I want the code to control List Box 301. If $BT$2 = 2, I want it to control List Box 302.
Grateful for any help.
VBA Code:
Sub DD_next()
Dim n%
With Sheets("scanner").Shapes("List Box 301").ControlFormat
n = .ListIndex
If n < .ListCount Then
.ListIndex = n + 1
Else
.ListIndex = 1
End If
End With
End Sub