PDA

View Full Version : Code for a find sort and copy.



ukmxer
09-12-2007, 01:09 AM
Is it possible to look at col C for a result greater than 0 and if one is found then copy cells abc of that row onto another sheet. Then repeat until end of data.
Then on the other sheet sort the data using column C in to descending order.to find the highest scores.

A=mem num (integer)
B= Name (String)
C= score (integer)

Bob Phillips
09-12-2007, 02:22 AM
Public Sub ProcessData()
Const TEST_COLUMN As String = "C" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, TEST_COLUMN).Value > 0 Then
iRow = iRow + 1
.Cells(i, TEST_COLUMN).Offset(0, -2).rsize(1, 3).Copy _
Worksheets("Sheet2").Cells(iRow, "A")
End If
Next i
End With

End Sub