SortFields.Clear Clarification

Viewed 1202

If this is my only sort statement in my sub then can I just delete SortFields.Clear? Any useful applications of using SortFields.Clear?

I don't think I have any existing sort fields at the start of my code. Or in the actual worksheet.

Code in question

    With ws_raw.Sort
            .SortFields.Clear
            .SortFields.Add2 Key:=Range("A1"), Order:=xlAscending
            .SortFields.Add2 Key:=Range("L2"), Order:=xlDescending
            .SetRange rng_raw
            .Header = xlYes
            .Apply
    End With

What I am trying to accomplish, looking for a similar code:

    With ws_raw.Sort
            .SortFields.Add2 Key:=Range("A1"), Order:=xlAscending
            .SortFields.Add2 Key:=Range("L2"), Order:=xlDescending
            .SetRange rng_raw
            .Header = xlYes
            .Apply
    End With

    ' main code

    With ws_raw.Sort
            .SortFields.Clear
            .Header = xlYes
            .Apply
    End With
0 Answers
Related