I have this macro that works on my office computer but when I run it at a client's computer It doesn't work and shows the
Error 438 object doesn't support this property
marking this line:
ActiveWorkbook.Worksheets("Hoja1").Sort.SortFields.Add2 Key:=Range("E2:E" & nFilas)
(My excel version is 365 and the client's is 2013)
I've tried changing Worksheets
by Sheets
, ActiveWorkbook
by Sheet
but nothing worked.
Columns("E:G").Select
ActiveSheet.Range("$E$1:$G$" & nFilas).RemoveDuplicates Columns:=Array(1, 2, 3), _
Header:=xlYes
Cells.Select
ActiveWorkbook.Worksheets("Hoja1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Hoja1").Sort.SortFields.Add2 Key:=Range("E2:E" & nFilas) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Hoja1").Sort
.SetRange Range("A1:X" & nFilas)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With