Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012
    Posts
    4

    Angry Unanswered: Challenge!!Sort all above a moving Total Row.

    Help Please!

    Im reating a speread sheet where My team can input a list of countries. once done I want them to sort the whole sheet in accordance to country name (column b, ascending). i created a macro to do this as many of them struggle with simple data sort function. My propblem is that my totals row whih sit s below the data keep getting dragged and sorted in with the rest of the data. I've selected a predetemined range of about 230 row to sort, as I figured they can't have more counrties than this to import, however this is where the countries keep getting drgged in. I've worked a macro to always find th e total row no matter how down it is. but hten I'm stuck any ideas? this is as far as I've got..

    ub Sort()
    '
    ' Sort Macro
    ' Macro recorded 03/05/2012 by GBWG6X
    '

    '
    Cells.Find(What:="Total", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate


    Rows("12:283").Select
    Selection.Sort Key1:=Range("B12"), Order1:=xlAscending, Header:=xlGuess, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal

    End Sub

  2. #2
    Join Date
    May 2012
    Posts
    10
    Code:
    Rows("12:" & ActiveCell.Row - 1).Select

  3. #3
    Join Date
    May 2012
    Posts
    4
    Worked perfecly! many thanks!

Posting Permissions

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