Thread: Delete Rows
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Bernie Bernie is offline
external usenet poster
 
Posts: 20
Default Delete Rows

That worked great, thank you so much.

How do I run the same macro for another name right after this one?

Bernie


Gary''s Student wrote:
This macro:

Sub remover()
v = Sheets("Sheet1").Range("A1").Value
For Each r In Sheets("Sheet2").UsedRange
If r.Value = v Then
r.EntireRow.Delete
Exit Sub
End If
Next
End Sub

will get the value in cell A1 of Sheet1. It will then go to Sheet2, locate
the first cell with that value and delete the entire row.
--
Gary's Student


"Bernie" wrote:

I would like to be able to delete a row with a name in it based on a
cell with that name from another cell in a different worksheet. Any
ideas?

Thanks,
Bernie