I need help. I know it's not the most difficult thing to do, but I just can't figure it out.
Sounds very easy, but I just can't find any info. Of course maybe because I've been working for the past 12 hours.
Anyways, here is what I need to do:
I have a macro that is processing multiple csv files, extracts data from them and than puts into a report. I need to get the files sorted by one of the columns to speed up the data population into the report. The problem is that the csv files have a header of 4 rows that i want to keep intact and just sort the data from row 5 all the way down. I use the below code and it keeps on sorting th whole file including the first 4 rows.
I would really appreciate if you could help. Thank you in advance.
With ActiveSheet
cl = .UsedRange.Columns.Count
rw = .UsedRange.Rows.Count
.UsedRange.Select
End With
' *****
Set MyRange = Selection
With MyRange
.Offset(3, 0).Resize(Selection.Rows.Count - 3, Selection.Columns.Count).Select
End With
Cells.Sort Key1:=MyRange, Order1:=xlAscending, Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Bookmarks