View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
[email protected] lhkittle@comcast.net is offline
external usenet poster
 
Posts: 168
Default Macro to open CSV files

On Sunday, March 31, 2013 10:14:41 PM UTC-7, rhhince wrote:
I wish to open CSV files and grab only the last 5000 lines of it to copy and paste in another xls file. Example: I open a CSV that has 5250 rows of data, but I only wish to copy the last 5000 rows. I am forced to delete the top 250 rows before being able to copy the 5000 rows of data. Is there a macro command to simply go to the bottom and grab those last 5000 rows to copy.


Hi rhhince,
A bit clunky but try something like this.

Option Explicit

Sub AllButTwoFiveOh()
Range("A10000").End(xlUp).Offset(-5000, 0).Resize(5000, 1).Copy Range("F1")
End Sub

Regards,
Howard