VBA Macro - Sort row (left to right) based on a pre-sorted worksheets

  • Try changing the "CustomSort" code to


    Leave the ArraySort code as it is.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • If you set the required format (font colour etc.) for the whole data area, then the macro will not change that and formatting should be correct after macro run.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • ehh.


    no. At the data sheet, some number had unique font colour & highlighted to represent something, tht y i cant set it as a whole.
    That y the previous script will not change anything and only shift the position.


    If you set the required format (font colour etc.) for the whole data area, then the macro will not change that and formatting should be correct after macro run.

  • This work but it cant retain the original colour / highlight.
    Some data is highlighted for special remark. I hope it can retain the riginal colour / highlight. only shift the position.


    Try changing the "CustomSort" code to


    Leave the ArraySort code as it is.