Kysteratwork
Technical User
Hi,
I would have to sort a large excel sheet by 4 criteria . Using the VBA recorder below is the code, but only for 3 criteria - if I add a fourth, I get an error message... is it not possible to have 4 criteria??
Thanks in advance for any indication you can provide.
KaW
I would have to sort a large excel sheet by 4 criteria . Using the VBA recorder below is the code, but only for 3 criteria - if I add a fourth, I get an error message... is it not possible to have 4 criteria??
Thanks in advance for any indication you can provide.
KaW
Code:
Dim i As Integer
i = MsgBox("Sort the Meetings Database?", vbOKCancel, "Meetings Database")
If i = vbOK Then
Sheets("MeetingsData").Select
Range("A2").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("L3"), Order1:=xlAscending, Key2:=Range("H3") _
, Order2:=xlAscending, Key3:=Range("F3"), Order3:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal, DataOption3:= _
xlSortNormal
End If
'And I added: Key4:=Range("B3"), Order4:=xlAscending