Posts by sham.shah

    I have a sheet with four columns that i want sorted from. I have recorded a macro to do it, which works fine for the 4 columns.

    How do I do that same thing for N columns


    • CT_CALC.xlsm

      (38.44 kB, downloaded 41 times, last: )

    I tried another code, that sort of works in finding the rank and reordering the columns.

    It goes haywire if the column is in its correct place (Column 1 is already in column 1, then it can't insert a column before it and paste) and also for the last column, as it is also in the correct place. How do i correct this?

    I have attached the simplified sheet. I want to achieve the following

    1. Rank the Sum Totals of each column (ROW 708), for that the VBA code is inserting the Rank formula in the row below the totals.

    2. Following in the rank, I want to rearrange each of the columns so the the smallest rank column is first, followed by the second, until the nth column

    3. After that I want to sort the contents of each column in Descending order, column 1 first, then column 2, until nth column.

    I hope this is clear. Thank you.


    • CT_CALC.xlsm

      (37.27 kB, downloaded 39 times, last: )

    I am trying to sort columns based on their rank.

    1. Range("RankRange").Find("4").Address

    However, I look for the column number each rank - I keep getting an error. I am new at VBA. When I copy and paste the values in the cells and then do the find it works. Not sure what to do. Finally, I want to sort the columns based on the rank in ascending order. If someone can help with this, it would be much appreciated. Thank you.