Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sorting+variable cell sizes | Excel Discussion (Misc queries) | |||
Sorting a data list with a variable | Excel Programming | |||
selecting and sorting a variable rowlength | Excel Programming | |||
Sorting - use of variable sort key | Excel Programming | |||
Sorting with variable number of sort fields | Excel Programming |