Hi
I am having a few problems with a Multi Select list box as follows
What I am trying to achieve, if a user selects 3 items, then write the values back to a sheet, these items are then removed from the listbox.
2nd time around the user selects all the other items.
The problem is the 2nd time around it is overwriting the data from the 1st selection, it works if all items are selected in one go, can somebody point me in the right direction?
Code for loading list box
Case "Service Reception"
With LBAuditP4
.List = Sheets("AC").Range("M2:U7").Value
.ColumnCount = UBound(.List, 2) + 1 'ubound(.list,2)= 8 columns + 1 = 9 columns
.ColumnWidths = "30pt;500pt;30pt;30pt;30pt;30pt;30pt;30pt;30pt"
End With
Code for selecting & removing items
With Me.LBAuditP4 '**
Select Case (Dept)
Case "Service Reception" ' Write details to DIndex sheet cells start at 6 to 11
For c = 0 To .ListCount - 1
If .Selected(c) Then
Worksheets(DIndex).cells(c + 1 + 5, "K").Value = Answer
Worksheets(DIndex).cells(c + 1 + 5, "L").Value = Worksheets("AC").Range("SRErrCode").cells(c + 1, 4).Value
Worksheets(DIndex).cells(c + 1 + 5, "M").Value = Worksheets("AC").Range("SRErrCode").cells(c + 1, 5).Value
Worksheets(DIndex).cells(c + 1 + 5, "N").Value = Worksheets("AC").Range("SRErrCode").cells(c + 1, 6).Value
Worksheets(DIndex).cells(c + 1 + 5, "O").Value = Worksheets("AC").Range("SRErrCode").cells(c + 1, 7).Value
Worksheets(DIndex).cells(c + 1 + 5, "P").Value = Worksheets("AC").Range("SRErrCode").cells(c + 1, 8).Value
Worksheets(DIndex).cells(c + 1 + 5, "Q").Value = Worksheets("AC").Range("SRErrCode").cells(c + 1, 9).Value
Worksheets(DIndex).cells(c + 1 + 5, "S").Value = Me.TxtAudNotes.Text
End If
Next c
Application.EnableEvents = False
For I = Me.LBAuditP4.ListCount - 1 To 0 Step -1 ' Remove items selected
If .Selected(I) = True Then
.RemoveItem (I) ' LBAuditP4.listindex+1
End If
Next I
Rob