I wanted to update a record from my listbox.
Record shows in ListBox(lstDisplay),when I clicked on a single record, those record will display in the textfield, where I can start to edit them.
And then I have to click Save to save the changes,however I'm getting an error.
Please see my code.
Please see screenshot screenshot
Private Sub cmdSave_Click()
Dim i As Integer
For i = 0 To Range("A65356").End(xlUp).Row - 1
If lstDisplay.Selected(i) Then
Rows(i + 1).Select
Sheet.Cells(i, 1) = txtSearch.Text
Sheet.Cells(i, 2) = txtLname.Text
Sheet.Cells(i, 3) = txtFname.Text
Sheet.Cells(i, 4) = txtCourse.Value
Sheet.Cells(i, 5) = txtYear.Value
End If
Next i
End Sub