Thread
:
sort method frustration
View Single Post
#
3
Posted to microsoft.public.excel.programming
Chip Pearson
external usenet poster
Posts: 7,247
sort method frustration
David,
I can't think of much else that might be causing the problem. Is
worksheet containing sRange active when you execute the sort?
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"David Wenahm" wrote in message
...
Chip,
Thanks for your Help!
Yes I have checked the srange address, I am sorting 6 six
columns of data and intsortcolumn2 = 6 prior and during
the statement. There is header data which is what the key
is pointing to.
Range address is $A$1:$F$154
srange is also set prior to the sort.
further suggestions?
David
-----Original Message-----
David,
Does the srange range contain the key cell?
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"David Wenham" wrote in message
...
The is method the first sort works fine.
srange.Sort _
Key1:=Cells(1, intSortColumn), Order1:=xlAscending,
Header:=xlYes
When I want to sort directly after by second column.
I receive runtime error "1004"
srange.Sort _
Key1:=Cells(1, intSortColumn2), Order1:=xlAscending,
Header:=xlYes
intsortcolumn2 does hold a value
srange is a valid object.
row 1 is the header.
Ideally I would like sort by both keys at the same time.
I used the macro record
Selection.Sort Key1:=Range(Cells(1, intSortColumn),
Cells(1, intSortColumn)), Order1:=xlAscending, _
Key2:=Range(Cells(1, intSortColumn2), Cells(1,
intSortColumn2)) _
, Order2:=xlAscending, Header:=xlYes,
OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom,
DataOption1:=xlSortNormal, DataOption2 _
:=xlSortNormal
Same error results.
Why is sort such a pain in the you know where?
Any ideas?
.
Reply With Quote
Chip Pearson
View Public Profile
Find all posts by Chip Pearson