Extract specific ranges from columns and put in another sheet VBA

  • This is very simple, but I am still struggling how to write the script correctly. So I have a table that have information in multiple columns in following layout



    A B C B C B C
    10119794
    5281 0 0278 1 2392 2
    1066246 5281 10 0278 24 2392 10
    1047076 5281 15 0278 9 2392 15



    The goal is find the correct VBA routine to cut/extract data from columns to rows in following layout, keeping only table title in another sheet:


    A B C
    10119794 5281 0
    1066246 5281 10
    1047076 5281 15
    B C
    10119794 0278 1
    1066246 0278 24
    1047076 0278 9
    B C
    10119794 2392 2
    1066246 2392 10
    1047076 2392 15



    Maybe there are the solution?


    Very appreciate any help.


    Thanks

  • Try the attached, run the procedure "ExtractToColumns" in Module 1


    The code:

  • Wow. I didn't expect it will be so complicated script. However I found an error in extraction sheet, where B values with 0 in the front are disappeared:


    0278 278 FALSE
    0057 57 FALSE
    0025 25 FALSE
    0127 127 FALSE
    0306 306 FALSE
    0051 51 FALSE
    0217 217 FALSE
    0963 963 FALSE


    I formatted entire sheet as text and after that B column values were shown correctly.


    Thanks a lot! :thumbup::):):)

  • You're welcome

    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.

Participate now!

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