Turn multiple columns into one

2

Hello, I do not program VBA and I am not able to make a code that would do the following:

|A |B |C |
----------
|1 |6 |11|
|2 |7 |12|
|3 |8 |13|
|4 |9 |14|
|5 |10|15|

My table has several columns like these up there, I would like you to help me with a routine that would read from column B and always put under column A, in this case would be in sequence from 1 to 15 in column A, Is this possible?

Result:

|A  |
-
|1  |
|2  |
|3  |
|4  |
|5  |
|6  |
|7  |
|...|
|14 |
|15 |
    
asked by anonymous 22.09.2016 / 17:31

1 answer

1

Author reply in comment.

Sub macro()
    'Step 1:  Declare your variables.
        Dim MyRange As Range
        Dim MyCell As Range
        Dim i As Double
        i = 6000
    'Step 2:  Define the target Range.
        Set MyRange = Range("A1:T5917")
    'Step 3:  Start looping through the range.
        For Each MyCell In MyRange
    'Step 4:  Do something with each cell.
        MyCell.Cut
        Cells(i, 1).Select
        ActiveSheet.Paste
    'Step 5: Get the next cell in the range
        i = i + 1
        Next MyCell
End Sub
    
11.10.2016 / 19:21