Hi guys, Im trying to put convert an initial N x 1 data, such that, for every 2nd term, it goes to the 2nd column and the 3rd term to the third column. This goes on for the remaining data.
e.g.
to become:
I have this small VBA script:
Sub MoveRange()
'Updateby20140730A
Dim rng As Range
Dim InputRng As Range, OutRng As Range
xTitleId = "Transform 2nd and 3rd row to 2nd and 3rd column"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set InputRng = InputRng.Columns(1)
For i = 1 To InputRng.Rows.Count Step 2
OutRng.Resize(1, 3).Value = Array(InputRng.Cells(i, 1).Value, InputRng.Cells(i + 1, 1).Value, InputRng.Cells(i + 2, 1).Value)
Set OutRng = OutRng.Offset(1)
Next
End Sub
However when running this, it gives me instead:
Can someone let me know what is wrong with my VBA code?
Thanks!
Bookmarks