Copy Paste - Columns

  • HI.,

    i am trying to copy & paste the range of columns to two columns with specified criteria., Attached herewith the code so far.


    the table consist of 6 columns. the first four columns are code nos with corresponding value in the last two column. i am trying to populate the following.


    1. first column to be placed in a certain location.
    2. the second column to be placed below the first column.
    3. the third column below the second column
    4. the fourth column below the third column.
    5. The value in the fifth column to be placed next column of the first column placed in sl.no:01
    6. the same value is placed again below the values pasted in the sl.no:5.
    7. The value in the sixth column to be placed below the sl.no:06
    8. the same value (sixth column) is placed again below the values pasted in the sl.no:7

    the code i tried below, able to achieve upto sl.no:6

  • Hi.,


    is it possible to filter each unique value, say a1, and copy the corresponding filtered values, sum up the values.


    Similarly all the values a2, a3, and a4 are filtered out and copy their corresponding values and sum up..?


    How to iterate the values a1, a2, a3 and a4 in autofilter criteria?

  • Since you have a very small range, this should do.

  • Thanks jolivanes.

    Last thing, if there are 'n' number of rows means, how to incorporate in the code.

    i tried inserted the following code


    Code
    1. lr = Cells(Rows.count, 6).End(xlUp).Row 'counting the no of rows
    2. codeArr = Range("F3:I" & lr).Value ' assigning the no of rows.
    3. lengthArr = Range("J3:K" & lr).Value

    but seems it has to be tweaked! could you pls help

  • Hi


    changing the value of ls to the row value work for the n rows . How to assign the variable 'ls' to get the number of rows from the starting cell F3 to the last row in with suitable datatype.

  • Try