View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Driscol[_2_] Mark Driscol[_2_] is offline
external usenet poster
 
Posts: 75
Default prevent a special cell from being deleted

Maybe something like this will work.

Option Explicit

Sub DeleteRow()

Dim row As Range
Dim c As Range

For Each row In Selection.EntireRow
Set c = row.Find(What:="Do Not Delete")
If c Is Nothing Then
row.Delete
End If
Next row

End Sub


Mark


jagexcel wrote:
The cell has the content "Do Not Delete"

How do I write an If statement to prevent this cell from being deleted
by a macro that deletes a row?

Thanks.


--
jagexcel
------------------------------------------------------------------------
jagexcel's Profile: http://www.excelforum.com/member.php...o&userid=35657
View this thread: http://www.excelforum.com/showthread...hreadid=556248