Re: Simple Macro (I think)
From: Jason (Jason_at_discussions.microsoft.com)
Date: 09/08/04
- Next message: Chip Pearson: "Re: work*** name"
- Previous message: antinoz: "Excel 2000"
- In reply to: Trevor Shuttleworth: "Re: Simple Macro (I think)"
- Next in thread: Steve Yandl: "Re: Simple Macro (I think)"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 8 Sep 2004 16:39:03 -0700
Thanks for your help Trevor. However, I do not want to specify what the
criteria is with the macro..... I only want to select the range and then have
the Excel built in sort userform pop up.... and then from there the user will
specify the criteria.... any further ideas?
"Trevor Shuttleworth" wrote:
> Jason
>
> the easiest way is to record the actions as you carry them out manually.
>
> You will get:
>
> Range("A2:D100").Select
> Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlYes, _
> OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
> DataOption1:=xlSortNormal
>
> This can be tidied up a little so that you don't need to select the range:
>
> Range("A2:D100").Sort _
> Key1:=Range("A3"), _
> Order1:=xlAscending, _
> Header:=xlYes, _
> OrderCustom:=1, _
> MatchCase:=False, _
> Orientation:=xlTopToBottom, _
> DataOption1:=xlSortNormal
>
> Note that key1 is Range("A3") because it assumes the header row is in row 2.
> That may not be what you want, in which case try:
>
> Range("A1:D100").Sort _
> Key1:=Range("A2"), _
> ' : etc
> ' :
>
> Regards
>
> Trevor
>
> "Jason" <Jason@discussions.microsoft.com> wrote in message
> news:F1498A51-C15C-46F1-BB08-402DFD36702F@microsoft.com...
> > I need a macro that will select a range (let's say A2:D100) and then will
> pop
> > open the sort userform box which is built into excel. I would also like
> the
> > sort userform when opened to have the "My list has Header Row" choice
> > selected as a default. From there the user will be able to interact with
> the
> > dialog box to select the different ways they may want to sort. Any help?
> > Thanks
>
>
>
- Next message: Chip Pearson: "Re: work*** name"
- Previous message: antinoz: "Excel 2000"
- In reply to: Trevor Shuttleworth: "Re: Simple Macro (I think)"
- Next in thread: Steve Yandl: "Re: Simple Macro (I think)"
- Messages sorted by: [ date ] [ thread ]