VBA to Find Occurence of Word, Then Custom Sort LOOP

  • Hello! I'm trying to create VBA code to essentially do:

    1. "Find" search for the word "Offer ID"

    2. Select that row and then "SHIFT+DOWNARROW" to select all rows from "Offer ID" until the next blank cell

    3. "Custom Sort" based on the values in Column N

    4. Loop back to step 1 and find the next occurrence of the "Offer ID"


    I tried to piece together some VBA code from a few different projects and from manually doing it using the "Record Macro" button to create the code, but I keep hitting road blocks. I'm looking at the "Range("A" & c & ":T")" portion and I'm sure that's part of the problem. In theory, I was hoping that code translated to grab A:T for the row of the current occurrence of "Offer ID" (ie: if the macro has found "Offer ID" on Row 20, it would be grabbing A20:T20. Then End(xlDown).Select would select all cells below until the next blank row. However, I think there might be a slew of problems with the sorting logic. I set Key:=Columns(14) to represent sorting based on the values in Column N, which is the 14th column over.


    Edited once, last by Jack in the UK: Added code tags - jiuk ().

  • Assuming you need to use the find, instead of using rangeAreas


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!