Below code only saves the date to the sheet for only 1 of the selected rows. I do not understand why other selected rows do not get the date value.
Sub SaveDateLastSend() Dim X As Integer
Dim iRow As Long 'To store the row number available in column T in sheet Log
'run for the loop
With frmFormLV.lstLogBook
For X = 0 To .ListCount - 1
If .Selected(X) Then
iRow = .Column(19, X)
Worksheets(“Log").Cells(iRow, 15).Value = Date
End If
Next X
End With
End sub
When debugging by returning the variable iRow in a messagbox only 1 variable is returned when the coding is like this:
'run for the loop
With frmFormLV.lstLogBook
For X = 0 To .ListCount - 1
If .Selected(X) Then
iRow = .Column(19, X)
MsgBox iRow
Worksheets(“Log").Cells(iRow, 15).Value = Date
End If
Next X
End With
End sub
But when I comment out the line to where the date is saved, all the variables are returned in messageboxes. So the loop should be fine I think.
'run for the loop
With frmFormLV.lstLogBook
For X = 0 To .ListCount - 1
If .Selected(X) Then
iRow = .Column(19, X)
MsgBox iRow
'Worksheets(“Log").Cells(iRow, 15).Value = Date
End If
Next X
End With
End sub
But it's not because only the first selected row gets the date returned. Why not the other rows? Hopefully someone can help me since I just started writing codes.