Hi qwzx
You will have to change the dimention of r to a long and then
Private Sub cmddel_Click()
Dim r As Long
Dim msgResponse As String 'confirm delete
Application.ScreenUpdating = False
'get user confirmation
msgResponse = MsgBox("THIS WILL DELETE THE SELECTED ROW, CONTINUE", _
vbCritical + vbYesNo, "DELETE ENTRY")
Select Case msgResponse 'action dependent on response
Case vbYes
'c has been selected by Find button
r = ListBox1.Column(6)' add r value here
Rows(r).EntireRow.Delete 'add this bit remove entry by deleting row
'restore form settings
With Me
.cmdrep.Enabled = False 'prevent accidental use
.cmddel.Enabled = False 'prevent accidental use
.cmdsub.Enabled = True 'restore use
'clear form
.txtfn.Value = vbNullString
.txtln.Value = vbNullString
.txtloc.Value = vbNullString
.txtph.Value = vbNullString
.txteml.Value = vbNullString
.cbostat.Value = vbNullString
End With
Case vbNo
Exit Sub 'cancelled
End Select
Application.ScreenUpdating = True
End Sub
column six of the list box is used to store the data lines row number
Bookmarks