|No such thing as a small change|
Re: Sort CSV file within Excel based on specific columnby davies (Parson)
|on Oct 12, 2012 at 20:54 UTC||Need Help??|
As others have implied, Excel may not be the best tool for you. But assuming it is (say you want to send summaries to managers who won't look at anything else), the following code should do the job, subject to a few points:
In Re^2: Sort CSV file within Excel based on specific column, you talk about removing Outbound calls, but in the OP you talk about sorting on column F, which contains the call time. As this is N/A in all cases in your example data, I have refrained from sorting. Please let us know if I have misunderstood.
I have used Advanced Filter to do the deletion as it is much faster, but if you want to delete line by line for some other reason, please see RFC Tutorial - Deleting Excel Rows, Columns and Sheets.
A few points. I strongly advise against taking control of an existing instance of Excel. I have written a few posts here on the subject. It seems to be a technique widely copied from something I can't remember reading, but if there are many more examples, I'll put up a
When using single quotes, you don't need to use multiple backslashes.
Your technique to find the last row will work for your case, but is very inefficient. I can dream up some cases where it might not work (I haven't tried).
Don't ->Select or ->Activate. See Excel’s Select and Activate considered harmful. It's fine to read these, but changing them is rarely necessary.