Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default selecting and sorting a variable rowlength

Hi,

I've got a sheet where I want to select and then sort, via a macro, a
colum of data.
It always starts at "A11", but the end is always different.
How do I select this and then sort it this way that the data behind it
(in colum "B11:E11" till the end) will follow.

I have this code, but for some reasson only the selected colum will
sort, the data in the collums behind it will not follow.

Range("A11").Select
Range(Selection, Selection.End(xlDown)).Sort Key1:=Range("A11"),
Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Can somebody please help me out?
Either by changing this code, or a total different solution.

Regards,
Maus

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default selecting and sorting a variable rowlength

Range("A11").Select
Range(Selection, Selection.End(xlDown)).Resize(,5).Sort
Key1:=Range("A11"),
Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal


--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi,

I've got a sheet where I want to select and then sort, via a macro, a
colum of data.
It always starts at "A11", but the end is always different.
How do I select this and then sort it this way that the data behind it
(in colum "B11:E11" till the end) will follow.

I have this code, but for some reasson only the selected colum will
sort, the data in the collums behind it will not follow.

Range("A11").Select
Range(Selection, Selection.End(xlDown)).Sort Key1:=Range("A11"),
Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

Can somebody please help me out?
Either by changing this code, or a total different solution.

Regards,
Maus



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default selecting and sorting a variable rowlength

Gentleman,


Thank you for your solutions.
They are working both...of course...:-)
But......
For some reason, the data from the row of cell "A11" is the only data
that won't be sorted.
The rest sorts fine, but the row of "A11" stays, like it was before
sorting.
And this is NOT because the data starts with an 'A'.

Can you please provide me with any help on that as well???

regards,
Maus

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,886
Default selecting and sorting a variable rowlength

Hi

Maybe it's because you have
Header = xlGuess and XL is guessing wrongly.
Try changing to
Header =xlNo
and see if it makes a difference.

--
Regards

Roger Govier


wrote in message
ps.com...
Gentleman,


Thank you for your solutions.
They are working both...of course...:-)
But......
For some reason, the data from the row of cell "A11" is the only data
that won't be sorted.
The rest sorts fine, but the row of "A11" stays, like it was before
sorting.
And this is NOT because the data starts with an 'A'.

Can you please provide me with any help on that as well???

regards,
Maus





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default selecting and sorting a variable rowlength

Thank you Rogier.....
That did the trick...!

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
Selecting a variable range Bill Excel Programming 4 August 16th 06 05:42 PM
selecting Variable range katmando[_10_] Excel Programming 4 May 18th 06 09:51 AM
selecting rows using a variable. cherrynich Excel Programming 2 May 2nd 06 08:27 PM
Selecting a row with a variable ? Blewyn[_6_] Excel Programming 3 April 20th 04 08:16 AM
Selecting a Range Using a Variable Bob J. Excel Programming 4 September 14th 03 09:24 PM


All times are GMT +1. The time now is 04:46 AM.

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

About Us

"It's about Microsoft Excel"