View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default VBA code to delete rows

Squirrel

Don't know what "refresh the links" means but for the second part.......

Sub delete_closed()
Dim C As Range
With ThisWorkbook.Sheets("Orders")
With Columns("B")
Do
Set C = .Find("Closed", LookIn:=xlValues, LookAt:=xlWhole, _
MatchCase:=False)
If C Is Nothing Then Exit Do
C.EntireRow.Delete
Loop
End With
End With
End Sub


Gord Dibben MS Excel MVP

On Sat, 20 Jan 2007 20:34:00 -0800, Secret Squirrel
wrote:

I have an excel worksheet ("Orders") that is linked to another worksheet
("Master Orders"). What I want to do is create a command button on my
worksheet ("Orders") that will refresh the links as well as delete any rows
on my worksheet ("Orders") that have the word "Closed" in column B. Can
anyone shed some light on how I would write this code?

Thanks
SS