#1   Report Post  
SMILE
 
Posts: n/a
Default sort and delete


Hi everyone
Someone please helpme......
I have an excel file with some data and the column "K" is to enter the
date of payment.
I want the data to be sorted by column "K" and delete the rows if it
has a data in column "K"

This is to find out the rows with no date in "K"

I need a macro to run

Thanks in Advance
Toms


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

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

How about an alternative.

Select your range (all of it or just column K).

Then use Data|Filter|Autofilter

You can use the dropdown arrow in column K to show just the blanks.

Or you can use that dropdown to show all the non-blanks (and delete those
visible rows if you really want).

If you need a macro, record one when you do it manually.

I really like keeping the data and hiding/showing the data.



SMILE wrote:

Hi everyone
Someone please helpme......
I have an excel file with some data and the column "K" is to enter the
date of payment.
I want the data to be sorted by column "K" and delete the rows if it
has a data in column "K"

This is to find out the rows with no date in "K"

I need a macro to run

Thanks in Advance
Toms

--
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
  #3   Report Post  
swatsp0p
 
Posts: n/a
Default


While I'm sure a macro can be built to do what you ask, have you looked
at AutoFilter? You can apply the filter to show only rows with blanks
in Col. K (or only non-blanks) which you can then delete enmasse or
copy to another area, etc.

Just a thought....


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=390143

  #4   Report Post  
SMILE
 
Posts: n/a
Default


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

  #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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting up some sort of cutting and pasting loop Trickster Excel Worksheet Functions 4 July 20th 05 07:13 AM
Sort a Subtotalled List? Rich Excel Discussion (Misc queries) 9 June 25th 05 11:59 AM
Select rows, then sort David Excel Discussion (Misc queries) 2 April 30th 05 04:36 AM
How do I delete dublicate cells? Retroactive78 Excel Discussion (Misc queries) 1 April 20th 05 09:26 PM
how do I reset the default sort order in excel xp back to blanks . MardiL Excel Discussion (Misc queries) 2 February 24th 05 08:15 PM


All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"