Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Frantic Excel-er
 
Posts: n/a
Default 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   Report Post  
Dave Peterson
 
Posts: n/a
Default

..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   Report Post  
Frantic Excel-er
 
Posts: n/a
Default

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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
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
Getting data from another workbook based on variable joemc911 Excel Discussion (Misc queries) 3 May 25th 05 09:18 AM
sort data without formulas in other cells changing? Vicky Excel Discussion (Misc queries) 2 March 15th 05 01:17 PM
macro to browse for workbook, pick up data and looping uriel78 Excel Worksheet Functions 1 March 10th 05 12:37 PM
Extract specific data into its own workbook via macro? Adrian B Excel Discussion (Misc queries) 2 February 24th 05 06:09 AM
Data > Sort function amnesia? Dave D Excel Discussion (Misc queries) 1 November 29th 04 10:44 PM


All times are GMT +1. The time now is 03:57 PM.

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

About Us

"It's about Microsoft Excel"