How to remove unwanted rows

Steve Swift

Board Regular
Joined
Jan 18, 2004
Messages
187
Hi all,

I have a csv which contains a 7 column header row

id number sale commission status Date supplier

As a result of me merging a number of csv's (in dos) and doing some sorting with a macro, I am left with a number of identical rows to this header row at the bottom of the sheet. Can anyone advise me how I can delete those with my macro?

In effect if any other rows exist that are the same as the header row then delete them.

Thanks

Steve
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
and doing some sorting with a macro

I think it may end up being easier fixing that macro so it doesn't do that...

Can you post the code to that macro ?
 
Upvote 0
Hi,

The macro is not what is causing the extra headers they are coming form merging the csv's using dos. I am simply unable to find a way to merge the csvs together in excel so an easy solution is dos using

copy *.csv merge.csv

gives me a single csv with all the content of every csv in the folder. As a result if there are 10 csv's I get 10 header rows. I sort by date with my macro and keep the top header row which puts all the other header rows at the bottom of the sheet.

If I could make a merge of all these csvs work in excel I'd do it that way but I cannot:(

Steve
 
Upvote 0
What collumn has your dates?
And are they VALID Excel Dates ? - To test, put this formula anywhere
=ISNUMBER(A1) where A1 is a cell with one of those dates..

TRUE or FALSE?
 
Upvote 0
Try this..assuming the header of column F is TEXT and not a number...

'This will find the LAST Date in column F
x = Application.Match(9.99999999999999E+307, Range("F:F"))

'This will delete everything past that
Range(x + 1 & ":65536").EntireRow.Delete


Hope this helps...
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,478
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top