View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default delete row based on value of cell in row

You create a range object by setting the variable equal to the range,
not to the range value... Set x = Cells(i, 6)

It is good practice to use the default property of objects instead of
letting Excel assume it... If not IsNumeric(x.Value) Then

Delete rows from the bottom up...
For i =ActiveSheet.UsedRange.Rows.Count to 8 Step -1
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"AD108" wrote in message ...
I am attempting to loop through each row of the used range of a sheet, and
then delete it based on its contents. My code is failing. Any help would
be appreciated. Thanks in advance.

For i = 8 To ActiveSheet.UsedRange.Rows.Count
Set x = Cells(i, 6).value
If Not IsNumeric(x) Then
ActiveSheet.Rows(i).Delete
End If
Next i