Results 1 to 9 of 9

Sort rows after a specific text is found

Threaded View

  1. #1
    Registered User
    Join Date
    11-23-2010
    Location
    dallas, texas
    MS-Off Ver
    Excel 2003
    Posts
    7

    Lightbulb Sort rows after a specific text is found

    Hello,

    I am needing help to find a macro that can: find a specific text - for ex: "Schedule (below)" in cell C100 - and after it is found, the code would skip the next row below, then sort
    all rows by date from oldest to newest.
    eg:
    A B C
    100 Schedule (below)
    101 Due WO# Name
    102 11/20 0395625 B.G
    103 11/18 0385612 C.F
    104 11/05 0396452 B.O.G

    to

    A B C
    100 Schedule (below)
    101 Due WO# Name
    102 11/05 0396452 B.O.G
    103 11/18 0385612 C.F
    104 11/20 0395625 B.G

    I've recorded a macro, but I don't know how to make it works if other users have input or added extra rows above the "Schedule (below)" row.
    Please help.

    My recorded code for my actual worksheet:
    Sub Macro1()
        Range("A1588").Select
        ActiveWindow.SmallScroll Down:=543
        Range("A1588:J2139").Select
        ActiveWorkbook.Worksheets("vinyl").Sort.SortFields.Clear
        ActiveWorkbook.Worksheets("vinyl").Sort.SortFields.Add Key:=Range( _
            "A1588:A2139"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
            xlSortNormal
        ActiveWorkbook.Worksheets("vinyl").Sort.SortFields.Add Key:=Range( _
            "C1588:C2139"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
            xlSortNormal
        ActiveWorkbook.Worksheets("vinyl").Sort.SortFields.Add Key:=Range( _
            "B1588:B2139"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
            xlSortNormal
        With ActiveWorkbook.Worksheets("vinyl").Sort
            .SetRange Range("A1588:J2139")
            .Header = xlGuess
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        ActiveWindow.SmallScroll Down:=-309
    End Sub
    Thanks very much in advance

    Tom
    Last edited by alansidman; 11-23-2015 at 07:55 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA to copy specific rows and stop when it found null rows
    By Khaled Diab in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2014, 01:50 AM
  2. [SOLVED] Would like to copy rows until specific value is found
    By caooi23 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2013, 01:41 AM
  3. Replies: 8
    Last Post: 06-03-2013, 05:34 PM
  4. [SOLVED] Locate column with specific title and delete rows if predefined set of text is found
    By johnny_tc in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-25-2012, 01:57 PM
  5. fastest way to find the row where a specific text is found in a specific column
    By getgray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2011, 02:45 PM
  6. Set variable sort range based on found text
    By jeffbert in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2006, 05:20 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1