If you want to sort data on multiple levels in a range .Snapshot below-
Here is the code-
Sub MULTI_LEVEL_SORT()
'1ST level SORT ON NAME COL A
'2ND level SORT ON START DATE COL B
'3RD levle SORT ON END DATE COL C
Sheets("Sample").Range("a1:d" & Sheets("Sample").Range("a1").End(xlDown).Row).Sort _
key1:=Sheets("Sample").Range("A:A"), order1:=xlAscending, _
key2:=Sheets("Sample").Range("B:B"), order2:=xlAscending, _
key3:=Sheets("Sample").Range("C:C"), order3:=xlAscending, _
Header:=xlYes
End Sub
Download Workbook
Subscribe to:
Post Comments (Atom)
Import data from SQL
Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...
-
Macro to Export Range in Json Format Option Explicit Sub export_in_json_format() Dim fs As Object Dim jsonfile Dim rangetoex...
-
If you want to run SQL queries within Excel environment without connecting to any database, you can do it with creating the ADODB conn...
If you are interested in learning Multiple Level Sorting Using VBA
ReplyDeletehttp://www.exceltip.com/tips/multiple-level-sorting-using-vbain-microsoft-excel-2010.html
This macro is perfect. Thank you very much. I used it in a macro from Cols A to W and for a sheet called "Misc". It works perfectly.
ReplyDeleteHi,
DeleteWould you please share your code of multi-level sorting as for me till 3rd level it is working fine but from 4th its started failing.
Thanks in advance.
excel version you are using ?
DeleteIts a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.
ReplyDeleteexcel vba courses london