So in column A I have a numerical value that i need to sort by number on column a and then by type on column L. I am piecing together a code using the macro recorder but I able to sort them seperately but it messes up the sort order once I try to secondary sort by column L. Any help or guidance would be appreciated!
VBA Code:
Option Explicit
Sub SortMyData()
Dim lr As Long
Application.ScreenUpdating = False
lr = Cells(Rows.Count, 1).End(xlUp).Row
Range("A7:Q" & lr).Sort key1:=Range("A7"), order1:=1
Application.ScreenUpdating = True
Cells.Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range("L3:L25") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A3:L25")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub