Can anyone help me with a piece of code that I currently get 'application-defined or object-defined error' with?
I am trying to simply sort the data with XL spreadsheet using access sub. The code bombs out at line XLRange.sort.....
I have simply copied and pasted the code from xl macro into access, but I guess the syntax is different somewhere?
Current code is as follows:-
rng = "A:AA"
Set xlRange = xlSht.Range(rng)
xlRange.Sort Key1:=Range("E2"), Order1:=xlAscending, Key2:=Range("H2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortTextAsNumbers
I am trying to simply sort the data with XL spreadsheet using access sub. The code bombs out at line XLRange.sort.....
I have simply copied and pasted the code from xl macro into access, but I guess the syntax is different somewhere?
Current code is as follows:-
rng = "A:AA"
Set xlRange = xlSht.Range(rng)
xlRange.Sort Key1:=Range("E2"), Order1:=xlAscending, Key2:=Range("H2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, DataOption2 _
:=xlSortTextAsNumbers