Delete Row

B

Bernie

I need to delete an entire row based on a name entered into an input
box that would match a worksheet with that name in column "A".


Thanks,
Bernie
 
G

Guest

Do you mean that if a name is entered into the InputBox and it matches a name
already entered "somewhere" in Column "A" , that you want to delete the
entire row for the cell location of the name in column "A"?

Sub anyName()
lr = Cells(Rows.Count, 1).End(xlUp).Row
Response = Application.InputBox("Enter a name", "Name to find", , , , , , 2)
For i = 1 To lr
If LCase(Cells(i, 1).Value) = LCase(Response) Then
Cells(i, 1).EntireRow.Delete
End If
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top