Sorting a column in a different worksheet

  • Thread starter Thread starter Ric Payne
  • Start date Start date
R

Ric Payne

I am trying to sort part of a column in a different sheet to the one I
am on.
The code i am using is:

With Worksheets("sortsheet")
..Unprotect Password:="pwd"
..Range("d3:d100").Sort Key1:=Range("D3"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
..Protect Password:="pwd"
End With

i keep getting a runtime 1004 error but when i use exactly the same
code while the "sortsheet" is active and i'm on that sheet it is fine.

What am i doing wrong?
Thanks in advance for your help.
 
Back
Top