Consulting

Results 1 to 2 of 2

Thread: Code for a find sort and copy.

  1. #1

    Code for a find sort and copy.

    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)

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba] 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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •