jbesclapez
Active Member
- Joined
- Feb 6, 2010
- Messages
- 275
Hello,
I sent a macro to another computer only to realize that it did not work because of a Sort issue in the code.
The macro above is not working on Office365 Excel but is working in Excel 2016.
When I replace in this macro the .SortFields.Add2 by .SortFields.Add then it is working!
So I decided to change in all my project the .SortFields.Add2 by .SortFields.Add
However, even if the macro is still working, the result shown is different.
So, Which one should I use and when? Also what is the difference then?
Thanks
I sent a macro to another computer only to realize that it did not work because of a Sort issue in the code.
HTML:
With ActiveWorkbook.Worksheets("APP").Sort .SortFields.Clear .SortFields.Add2 Key:=Range("B2:B" & LastA), Order:=xlAscending .SortFields.Add2 Key:=Range("A2:A" & LastA), Order:=xlAscending .SortFields.Add2 Key:=Range("C2:C" & LastA), Order:=xlAscending .SortFields.Add2 Key:=Range("D2:D" & LastA), Order:=xlAscending .SortFields.Add2 Key:=Range("E2:E" & LastA), Order:=xlAscending .SortFields.Add2 Key:=Range("F2:F" & LastA), Order:=xlAscending .SetRange Range("A1:G" & LastA) .Header = xlYes .Apply End With
The macro above is not working on Office365 Excel but is working in Excel 2016.
When I replace in this macro the .SortFields.Add2 by .SortFields.Add then it is working!
So I decided to change in all my project the .SortFields.Add2 by .SortFields.Add
However, even if the macro is still working, the result shown is different.
So, Which one should I use and when? Also what is the difference then?
Thanks