LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Variable sorting

In Excel 2003 I have a range A15 to U500. In column B there will be either the text value
P or S. I want to do a sort on the range which will involve 4 criteria. To achieve this I
want to sort column B to order the P and S. I then want to select the rows with P and sort
by the three other criteria. I then need the rows below these with S and sort by the same
criteria. I have a schematic below of what I was trying but my problem is in selecting the
row range or how best to do it. eg below I was trying-- rows ("15:14+a").select ---but
this is obviously not the way to do it. There may be and probably is a better way to do
the whole thing but I would value any help.

Sub sorting()
Dim n As Integer
a = 0
For n = 15 To 500
If Cells(n, 2) 0 Then
a = a + 1
End If
Next
How to get this to work "select rows 15 to 14+a" <<<<<<<<

'<< selection sort by column 2 I can do this
b = 0
For n = 15 To 500
If Cells(n, 2) = "P" Then
b = b + 1
End If
Next
How to get this to work "select rows 15 to 14+b" <<<<<<<<

'<< selection sort by columns 3 7 and 8 I can do this
How to get this to work "select rows 15+b to 14+a" <<<<<<<<

'<< selection sort by columns 3 7 and 8 I can do this
End Sub

Graham
 
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
sorting+variable cell sizes BobG[_2_] Excel Discussion (Misc queries) 3 April 23rd 08 04:19 AM
Sorting a data list with a variable [email protected] Excel Programming 1 July 16th 07 07:38 PM
selecting and sorting a variable rowlength [email protected] Excel Programming 5 September 10th 06 04:00 PM
Sorting - use of variable sort key BernzG[_20_] Excel Programming 1 May 12th 06 12:16 AM
Sorting with variable number of sort fields BW Excel Programming 2 August 6th 05 07:15 PM


All times are GMT +1. The time now is 12:14 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"