PDA

View Full Version : Runtime Error 438



dcondillac
12-16-2019, 05:35 AM
I have created a VBA script that works perfectly fine on my system, but when i run it on my colleagues system it starts working but stops at the point highlighted in bold below. the error is 438.

Range("A10:H13000").Select
ActiveWorkbook.Worksheets("PASSPORT_BANK").SORT.SortFields.Clear
ActiveWorkbook.Worksheets("PASSPORT_BANK").SORT.SortFields.Add2 Key:=Range( _
"D10: D12609"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("PASSPORT_BANK").SORT.SortFields.Add2 Key:=Range( _
"B10:B12609"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("PASSPORT_BANK").SORT
.SetRange Range("A9:H12609")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

Fluff
12-16-2019, 05:43 AM
Hi & welcome to the board.
Change Add2 to Add both times it appears.

dcondillac
12-16-2019, 09:03 AM
Working perfectly thank you

Fluff
12-16-2019, 09:33 AM
You're welcome & thanks for the feedback