Sub CommandButton1_Click()
Private Sub CommandButton1_Click()
Dim nme As String
Dim cll As Range, rng As Range
Dim rcrd As Integer
Set rng = Sheets("Project List").Range("A4:A20") '// "Project List" is the sheet name
rcrd = 0
nme = InputBox("Please type the name of person who's records you wish to delete", "Record delete facility!")
If nme = "" Then Exit Sub
If MsgBox("You have chosen to delete " & nme & "'s records from the database!" & Chr(10) & "Is this correct?", 52, "DELETING RECORDS!!") = vbNo Then MsgBox "Nothing has been deleted.": Exit Sub
For Each cll In rng
If cll.Value = nme Then
Sheets("Project List").Rows(cll.Row).EntireRow.Delete
rcrd = rcrd + 1
End If
Next
If rcrd > 0 Then
MsgBox rcrd & " of " & nme & "'s records have been deleted!"
Else
MsgBox "There were no records matching that name." & Chr(10) & "No records have been deleted."
End If
End Sub