Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Sorting a column in a different worksheet

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sorting a column in a different worksheet

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting a worksheet with embedded documents in one column JHQ Excel Discussion (Misc queries) 2 October 21st 08 05:45 PM
Sorting Master Worksheet to Regional Worksheet teapot10 Excel Worksheet Functions 3 April 14th 08 07:08 PM
Sorting a Pivot Table Column that is not the first column... [email protected] Excel Worksheet Functions 1 October 10th 07 09:02 PM
How do I limit sorting a column to the column? Pat Excel Worksheet Functions 0 February 9th 06 04:01 PM
Right column doesn't change when sorting left column. nohope Excel Discussion (Misc queries) 2 July 19th 05 03:27 PM


All times are GMT +1. The time now is 01:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"