+ Reply to Thread
Results 1 to 4 of 4

Macro - Data Sort -Variable Selection

  1. #1
    Frantic Excel-er
    Guest

    Macro - Data Sort -Variable Selection

    Hi all!!!

    I am trying to get my macro to run a sort in a non specific cell for column
    D.....there are many steps up to this point, I will include the last couple
    in the code...here is what I have so far....

    Columns("C:C").Find(What:="x").EntireRow.Insert
    Columns("C:C").Find(What:="x").EntireRow.Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Sort Key1:=Range("D63"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

    Instead of the range being specific for D63, I want it to select the D
    column after if finds X to the end of the wkst. Any ideas on how I can
    accomplish this???

    Thanks in advance......



  2. #2
    Dave Peterson
    Guest

    Re: Macro - Data Sort -Variable Selection

    ..Sort is pretty forgiving. Didn't it work using D63?

    I've used:

    ....key1:=range("d:d"), ...

    And that works, too.

    Frantic Excel-er wrote:
    >
    > Hi all!!!
    >
    > I am trying to get my macro to run a sort in a non specific cell for column
    > D.....there are many steps up to this point, I will include the last couple
    > in the code...here is what I have so far....
    >
    > Columns("C:C").Find(What:="x").EntireRow.Insert
    > Columns("C:C").Find(What:="x").EntireRow.Select
    > Range(Selection, Selection.End(xlDown)).Select
    > Range(Selection, Selection.End(xlToRight)).Select
    > Selection.Sort Key1:=Range("D63"), Order1:=xlAscending, Header:=xlGuess, _
    > OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    >
    > Instead of the range being specific for D63, I want it to select the D
    > column after if finds X to the end of the wkst. Any ideas on how I can
    > accomplish this???
    >
    > Thanks in advance......
    >
    >


    --

    Dave Peterson

  3. #3
    Frantic Excel-er
    Guest

    Re: Macro - Data Sort -Variable Selection

    Selecting "d:d" works, but it will select the whole column... I only want to
    sort the selection after I find x and sort that....

    "Dave Peterson" wrote:

    > ..Sort is pretty forgiving. Didn't it work using D63?
    >
    > I've used:
    >
    > ....key1:=range("d:d"), ...
    >
    > And that works, too.
    >
    > Frantic Excel-er wrote:
    > >
    > > Hi all!!!
    > >
    > > I am trying to get my macro to run a sort in a non specific cell for column
    > > D.....there are many steps up to this point, I will include the last couple
    > > in the code...here is what I have so far....
    > >
    > > Columns("C:C").Find(What:="x").EntireRow.Insert
    > > Columns("C:C").Find(What:="x").EntireRow.Select
    > > Range(Selection, Selection.End(xlDown)).Select
    > > Range(Selection, Selection.End(xlToRight)).Select
    > > Selection.Sort Key1:=Range("D63"), Order1:=xlAscending, Header:=xlGuess, _
    > > OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    > >
    > > Instead of the range being specific for D63, I want it to select the D
    > > column after if finds X to the end of the wkst. Any ideas on how I can
    > > accomplish this???
    > >
    > > Thanks in advance......
    > >
    > >

    >
    > --
    >
    > Dave Peterson
    >


  4. #4
    Dave Peterson
    Guest

    Re: Macro - Data Sort -Variable Selection

    Don't select column D.

    But do use it in the key1:=range("d:d") portion.

    Then what happens?

    Frantic Excel-er wrote:
    >
    > Selecting "d:d" works, but it will select the whole column... I only want to
    > sort the selection after I find x and sort that....
    >
    > "Dave Peterson" wrote:
    >
    > > ..Sort is pretty forgiving. Didn't it work using D63?
    > >
    > > I've used:
    > >
    > > ....key1:=range("d:d"), ...
    > >
    > > And that works, too.
    > >
    > > Frantic Excel-er wrote:
    > > >
    > > > Hi all!!!
    > > >
    > > > I am trying to get my macro to run a sort in a non specific cell for column
    > > > D.....there are many steps up to this point, I will include the last couple
    > > > in the code...here is what I have so far....
    > > >
    > > > Columns("C:C").Find(What:="x").EntireRow.Insert
    > > > Columns("C:C").Find(What:="x").EntireRow.Select
    > > > Range(Selection, Selection.End(xlDown)).Select
    > > > Range(Selection, Selection.End(xlToRight)).Select
    > > > Selection.Sort Key1:=Range("D63"), Order1:=xlAscending, Header:=xlGuess, _
    > > > OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    > > >
    > > > Instead of the range being specific for D63, I want it to select the D
    > > > column after if finds X to the end of the wkst. Any ideas on how I can
    > > > accomplish this???
    > > >
    > > > Thanks in advance......
    > > >
    > > >

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1