VBA - Sorting cell values in an ascending order RRS feed

  • Question

  • Hello, I have developed a VBA code which calculates the necessary results from my sheets. What I need now is to search through the results in a certain column and sort the minimum number between the values in that column plus to sort the other related columns according to the first sorted column.

    Ex. If the minimum time in column "B" is 2 hours which is located in "B43". I need cell "B43" to be located in "B1". Additionally, I want "A43" and "C43" to be sorted in "A1" and "C1". Accordingly, I need the rest of the cells to be sorted in an ascending order from the lowest to the highest similar to the example cell "B43" mentioned above with linking the other columns.

    Please suggest any advise or help. Regards
    Tuesday, July 23, 2013 4:23 AM

All replies

  • It sounds to me as if you want to do a standard sort.
    You should use the entire data set and specify a particular column to sort on.
    Recording a macro while you do a sort will give you most of the code you need.
    The Excel vba help file does a pretty good job of explaining things.

    Jim Cone
    Portland, Oregon USA (Dropbox)
    (free & commercial excel add-ins & workbooks)

    • Edited by James Cone Tuesday, October 25, 2016 1:49 AM
    Tuesday, July 23, 2013 5:18 AM