Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Add
Worksheets("sortsheet").activate just before your 'with' -----Original Message----- 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. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting a worksheet with embedded documents in one column | Excel Discussion (Misc queries) | |||
Sorting Master Worksheet to Regional Worksheet | Excel Worksheet Functions | |||
Sorting a Pivot Table Column that is not the first column... | Excel Worksheet Functions | |||
How do I limit sorting a column to the column? | Excel Worksheet Functions | |||
Right column doesn't change when sorting left column. | Excel Discussion (Misc queries) |