Quantcast
Channel: CSharp Forum Latest Questions
Viewing all articles
Browse latest Browse all 32059

Rearrange The Data

$
0
0
I've the data like this
Item 1,Item 2,Item 3
Product 1a,Product 1b,Product 1c
Product 2a,Product 2b,Product 2c

And I want to rearrange like this using macros
Product 1a
Product 1b
Product 1c
Product 2a
Product 2b
Product 2c
Product 3a

This is the code I have so far

Sub test()
Dim LR As Long, i As Long
LR = Range("D" & Rows.Count).End(xlUp).Row
Columns("D").Insert
For i = 2 To LR
Range("D" & i).Resize(, 3).Copy
Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, Transpose:=True
Next i
Columns("D").Delete
End Sub


Viewing all articles
Browse latest Browse all 32059

Trending Articles