sharky12345
Well-known Member
- Joined
- Aug 5, 2010
- Messages
- 3,404
- Office Version
- 2016
- Platform
- Windows
I have a multi-select Listbox on a userform and I am trying to select an item using VBA if the value of a textbox is specific.
This is what I have but I keep getting an error that the control source could not be set;
For info, the Listbox is populated when the userform loads like this;
Can someone please put me out of my misery?
This is what I have but I keep getting an error that the control source could not be set;
VBA Code:
For i = 1 To 12
If CheckFrm("TextA" & i).Value = "Issues found" Or CheckFrm("TextA" & i).Value = "Not checked" Or CheckFrm("TextA" & i).Value = "Out of service" Then
ListBoxCells.Selected("A" & i) = True
End If
For info, the Listbox is populated when the userform loads like this;
VBA Code:
With ListBoxCells
For i = 1 To 12
.AddItem "A" & i
Next i
For i = 13 To 24
.AddItem "B" & i
Next i
For i = 25 To 36
.AddItem "C" & i
Next i
End With
Can someone please put me out of my misery?