Hi,
I am building a fabrication tracking spreadsheet and have a userform that allows staff members to update the status of an item to "Complete" when the item is finished. The userform contains a listbox in which they can can select multiple items if required, with a command button to confirm the selections.
When running the code "Complete" is added to the top selection only, rather than all selected items?
This is the code I am using - excluding the 'Else' from the IF statement only allows the status to Item 1 to be updated.
Any thoughts would be appreciated!
In addition, I would like to the loop to stop at the last row with data within the listbox (I can have up to 150 items).
I am building a fabrication tracking spreadsheet and have a userform that allows staff members to update the status of an item to "Complete" when the item is finished. The userform contains a listbox in which they can can select multiple items if required, with a command button to confirm the selections.
When running the code "Complete" is added to the top selection only, rather than all selected items?
This is the code I am using - excluding the 'Else' from the IF statement only allows the status to Item 1 to be updated.
Any thoughts would be appreciated!
In addition, I would like to the loop to stop at the last row with data within the listbox (I can have up to 150 items).
VBA Code:
Sub SaveSelected()
Dim i As Long
Dim j As Integer
j = 9
With Fabrication.FabStatus
For i = 0 To .ListCount - 1
If .Selected(i) Then
Worksheets("Quote_Breakdown").Cells(j, 1).Value = "Complete"
Else
j = j + 1
End If
Next i
End With
End Sub