Anis
In order for people to help you, you must be as specific as possible. Bear in mind that no one but you knows your project so you need to describe exactly what you want to achieve, otherwise folk will do work to help you out, then will need to do more when you come back and explain what the ACTUAL problem is.
You said that you wish to delete a row "Having the name Anis."
Is the row actually named "Anis" (i.e. have you declared a named range?), or do you have a list of names down a column (col "A" perhaps?), with associated data accross the rows (Records), and what you want to do is find a specific name in the column, and delete the whole record from the table.
I'll assume that this is what you're trying to do:
As long as the button's from the Control Toolbox, right_click it, select "View Code" and make the whole code look thus:
Code:
Private Sub CommandButton1_Click()
Dim nme As String
On Error GoTo err_handler
nme = InputBox("Please type the name of person who's record you wish to delete", "Record delete facility!")
If nme = "" Then Exit Sub
If MsgBox("You have chosen to delete " & nme & "'s record from the database!" & Chr(10) & "Is this correct?", 52, "DELETING RECORD!!") = vbNo Then MsgBox "Nothing has been deleted.": Exit Sub
Me.Rows(Application.WorksheetFunction.Match(nme, Me.Range("A1:A20"), 0)).EntireRow.Delete
MsgBox nme & "'s entire record has been deleted!"
Exit Sub
err_handler: MsgBox "The name was not found in the database!" & Chr(10) & "Nothing has been deleted.!"
End Sub
This assumes that:
1. Your button is called CommandButton1.
2. Your list of names is contained within A1:A20, which it almost definitely won't be, so you'll have to change this reference to suit, BUT ALWAYS BEGIN WITH ROW 1, NOT THE NUMBER OF THE ROW YOUR DATA STARTS ON, ELSE THE WRONG ROW WILL BE DELETED.
Also, as records are deleted, so the range may have to change - it depends how volatile your "database" is.
You could just go completely over the top, and overestimate how many records you'll be using, so if you only ever expect there to be 25, then use the range A1:A50, to be on the safe side. It would be much better coding to dynamically find the ACTUAL existing range, and define the data that way, but as I'm not at all sure if this is what you want, then I'm not going down that road for you.