View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default Number format as condition for not deleting a line

If application.isnumber(activecell.value) then

would check to see if the activecell were numeric.

But your original code actually deletes the row under the cell with posted.

And I'd suggest that you start from the bottom and work upwards if you don't
want to use the routine I posted.




mjwillyone wrote:

Gentlemen,

Actually, here is a routine I have that works great to delete all rows
where the word "Posted" is not found in cell "B" of a row. All I
needed to do was tweak this so that is would not look at cell "A" of a
row, determine if the value in cell "A" is a number and delete the row
if it is not.

I know that I would need to change the range to "A1" but do not know
what I have to do with the 'If ActiveCell = "Posted" Then' text to
get it to look at the numeric cell attribute of the activecell.

Worksheets("sheet1").Activate
Range("B1").Select

Counter = InputBox("Enter the total number of rows to process")

For i = 1 To Counter
If ActiveCell = "Posted" Then
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Delete
Counter = Counter - 1
Else
Selection.EntireRow.Delete
End If
Next i

Thanks,
Mike

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson