Sorting a column in a different worksheet

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top