I'm trying to preselect (or make the checkbox=true) in a combolist in Excel 2003 through VBA. This is due to the fact that 204 items are the normal selected items. I wanted to provide the flexibility to the user to either select or remove additional items.
Here's the code I have so far and the line with "lstStep_List.List(i) = True" is where it breaks
thx for your help
Here's the code I have so far and the line with "lstStep_List.List(i) = True" is where it breaks
Code:
Private Sub PopulateListbox()
Cells.Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
Selection.End(xlToRight).Select
endcol = ActiveCell.Column
Range("A1").Select
startrow = ActiveCell.Address
NumSteps = 0
Do While ActiveCell.Value <> ""
NumSteps = NumSteps + 1
ActiveCell.Offset(0, 1).Select
Loop
Range(startrow).Select
i = ActiveCell.Column
c = i
Do While i < NumSteps + c
If i < NumSteps + c Then
lstStep_List.AddItem (Cells(ActiveCell.Row, i).Value)
If Application.VLookup(Cells(ActiveCell.Row, i).Value, Schedule_Views.Range("a1:b260"), 2, False) = "Hide Column" Then
[b] lstStep_List.List(i) = True[/b] "THIS IS WHERE IT BREAKS"
End If
i = i + 1
End If
Loop
End Sub