View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default If True then DO, otherwise DON"T

Cells.Find retruns a Range not a Boolean. How about:

Sub RemoveAvgPricesBOD2()
Dim r As Range
Set r = Cells.Find(What:="Average Prices")
If r Is Nothing Then Exit Sub
r.EntireRow.ClearContents
End Sub
--
Gary''s Student - gsnu200821


"MikeF" wrote:

This should be very simple, but can't seem to make it work properly ..
The following procedure is called from another as application.run.
All it needs to do is delete the only row that contains the text Average
Prices.
... If the text Average Prices doesn't exist, don't delete anything/do
nothing and move on.
Thanx in advance for any assistance.
- Mike

Sub RemoveAvgPricesBOD()

On Error Resume Next
If Cells.Find(What:="Average Prices") = True Then
Cells.Find(What:="Average Prices").EntireRow.ClearContents
If Cells.Find(What:="Average Prices") = False Then
Exit Sub
End If
End If

End Sub