Thread: sort and delete
View Single Post
  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

I recorded a macro that selected column K, did the autofilter, showed the
non-blank cells and deleted those visible rows and removed the autofilter.

Option Explicit
Sub Macro1()
Columns("K:K").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<"
Range("K2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.EntireRow.Delete
Range("K1").Select
Selection.AutoFilter
End Sub

It seemed to work fine no matter the number of rows.

SMILE wrote:

Hi
I do agree the autofilter will do.. but in my case I do not want the
autofilter.. I really need a macro to run. I cannot record a new macro
doing it mannual becoz each time the number of rows will be different.
Hope someone can help me.....
Thanks

--
SMILE
------------------------------------------------------------------------
SMILE's Profile: http://www.excelforum.com/member.php...fo&userid=4880
View this thread: http://www.excelforum.com/showthread...hreadid=390143


--

Dave Peterson