View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
PCLIVE PCLIVE is offline
external usenet poster
 
Posts: 168
Default Selecting a defined Name via a cell's contents

I am using a defined name range. And you are correct as usual. Your code
is much prettier than what I was using. I have updated my code to mirror
your suggestions.
It works great!

Thanks for everything.
Paul

"JE McGimpsey" wrote in message
...
First, are you using the defined name range or the Selection? There's no
need to select anything:

With Range(Range("A2").Value)
.Sort Key1:=.Cells(1,1), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
End With



(and no, there's no reason to use continuation lines rather than putting
it all on one line - I just find it more readable).

In article ,
"PCLIVE" wrote:

JE,

I've got one more thing that I need help with.

This is still regarding defined name ranges.

Selection.Sort Key1:=Range("AJ2"), Order1:=xlAscending, Header:=xlNo,
_
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Im using the above code to sort. however, I need to base the 'SortKey1'
on
the first column of the selected unknown defined name range.
Without knowing that AJ2 is the first column of the define name range
that
is selected (which was selected using the previous suggestion
Range(Range("A2").Value).Select ), I need to sort based on the first
column of the selected range

Can this be done?