views:

17

answers:

2

Ex. I want to take the column with 12345..... and order 5 columns across as seen. next 5 numbers in column will be next row. However my code creates a 4 row gap in between each successive row. I dont know what additional logic (possibly if then statement) I can embed into do loop to may make it cleaner. I am new to this, so showing as much sample code to learn the syntax would be most beneficial. thanks in advance.

Below is the Result of my code. VBA code is below result.

1 1 2 3 4 5 2
3
4
5
6 6 7 8 9 10 7
8
9
10
11 11 12 13 14 15 12
13
14
15
16 16 17
17

Sub Working_Code() ' Working_Code Macro

Do ActiveCell.Select Selection.Copy ActiveCell.Offset(0, 5).Select ActiveSheet.Paste ActiveCell.Offset(1, -5).Select

Selection.Copy
ActiveCell.Offset(-1, 6).Select
ActiveSheet.Paste
ActiveCell.Offset(2, -6).Select

Selection.Copy
ActiveCell.Offset(-2, 7).Select
ActiveSheet.Paste
ActiveCell.Offset(3, -7).Select

Selection.Copy
ActiveCell.Offset(-3, 8).Select
ActiveSheet.Paste
ActiveCell.Offset(4, -8).Select

Selection.Copy
ActiveCell.Offset(-4, 9).Select
ActiveSheet.Paste
ActiveCell.Offset(5, -9).Select

Loop Until IsEmpty(ActiveCell.Offset(0, -1))

End Sub

A: 

original post showed example wrong. here is the correct example

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

1 2 3 4 5

6 7 8 9 10

11 12 13 14 15

16 17

Curious
A: 

top line of last post is the column

Curious