I have a VBA listbox that seems to reset the selections within the listbox whenever calculations are performed on the sheet, or when I open the sheet. That is to say, previous items selected clear from the box when unrelated calucations run.
Also, when I add items to the defined list of the listbox, they don't show up in the listbox ?
Is there anything faulty in my code below:
Private Sub lb1_Change()
Dim i, j As Integer
j = 1
Sheets("Settings").Range("results").Value = ""
With lb1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Sheets("Settings").Range("results").Cells(j, 1).Value = lb1.List(i)
j = j + 1
End If
Next i
End With
End Sub
Thanks - Mark
Also, when I add items to the defined list of the listbox, they don't show up in the listbox ?
Is there anything faulty in my code below:
Private Sub lb1_Change()
Dim i, j As Integer
j = 1
Sheets("Settings").Range("results").Value = ""
With lb1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Sheets("Settings").Range("results").Cells(j, 1).Value = lb1.List(i)
j = j + 1
End If
Next i
End With
End Sub
Thanks - Mark