Thread: One more macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Grace[_4_] Grace[_4_] is offline
external usenet poster
 
Posts: 106
Default One more macro

This seems to eliminate only rows that are totally empty. Try it. I want
it to eliminate all rows where the entry in column A is not a number. If
there is a number in column C, but not in column A, I would want to delete
that row. That said, it seems to be leaving rows where column C has an
entry that is not a number, just some text.

Thanks
Dean

"mudraker " wrote in message
...
Grace

Here is the code for the first part of your request

Delete rows where cell in column a is not numeric & sort data

Deletion code starts from the last row and works back to row 21 as this
is the easiest way to code row deletions



I did not understand fully where you wanted to copy A1 down to so did
not include that part in the code




Sub dddd()
Dim lRow As Long
For lRow = Range("a" & Rows.Count).End(xlUp).Row To 21 Step -1
If Not IsNumeric(Cells(lRow, "a")) Then
Rows(lRow).Delete
End If
Next lRow
lRow = Range("a" & Rows.Count).End(xlUp).Row
Range("a21:e" & lRow).Sort _
Key1:=Range("B21"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom

End Sub


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