I am running a UF which has 3 listboxes. I have BoxA_Click()
, BoxB_Click
subs for each, that select a cell on the a sheet when executed. If I click a value in BoxA, the macro executes and the cell is selected. Then if I click a value in BoxB, the macro executes and locates a different cell. The problem is, when I click back on BoxA, if I select the value that is already selected, then the BoxA_Click()
macro will not execute, because I haven't technically changed the selection in that particular box.
My attempted solution was to create a frame, FrameMove, where I have put all 3 listboxes. I have tried to write something that will deselect the other 2 boxes when one box is clicked.
Private Sub BoxA_Click()
GoToCell(BoxA.Value)
Dim C As MSForms.Control
For Each C In FrameMove.Controls
If TypeOf C Is MSForms.ListBox Then 'C.ListIndex = -1 ???
Next C
End Sub
I am currently looping through all controls within the frame, because I'm not sure how to loop through ListBoxes specifically. Is there a way I can make this work to deselect all other listboxes when one listbox is selected?