Continuous conversion of data from rows to columns

K

Karaman

I have roows of data looks that look like this:
Text1 Text1 Text1 Text1 1 2 3 4 5 6 7 8 9 10 11
Text2 Text2 Text2 Text2 1 2 3 4 5 6 7 8 9 10 11
Text3 ......

I'm trying to convert the above to look like this:
Text1 Text1 Text1 Text1 1 2 3 4
5 6 7 8
9 10 11
Text2 Text2 Text2 Text2 1 2 3 4
5 6 7 8
9 10 11
Text3.....

I created a macro within Excel to arrange the Text1 data, but how can I
continue reading and arranging the next rows within the macro to repeat what
was done to the first one? I assume it's a Do Loop, but just need the code
to force it to read
Row2 and repeat the same process for an "n" number of rows. Thanks.
 
J

Jim Thomlinson

Now I see your problem from yesterday... Here is some code that I think will
work for you...

Public Sub ConsolidateRows()
Dim wksCopyFrom As Worksheet
Dim rngCopyFrom As Range
Dim wksCopyTo As Worksheet
Dim rngCopyTo As Range

Set wksCopyFrom = ActiveSheet
Set rngCopyFrom = wksCopyFrom.Range("A2")
Set wksCopyTo = Worksheets.Add
Set rngCopyTo = wksCopyTo.Range("A2")

Do While rngCopyFrom.Value <> ""
Range(rngCopyFrom, rngCopyFrom.Offset(0, 7)).Copy rngCopyTo
Set rngCopyTo = rngCopyTo_Offset(1, 0)
Range(rngCopyFrom.Offset(0, 8), rngCopyFrom.Offset(0, 11)).Copy
rngCopyTo_Offset(0, 4)
Set rngCopyTo = rngCopyTo_Offset(1, 0)
Range(rngCopyFrom.Offset(0, 12), rngCopyFrom.Offset(0, 15)).Copy
rngCopyTo_Offset(0, 4)
Set rngCopyTo = rngCopyTo_Offset(1, 0)
Set rngCopyFrom = rngCopyFrom.Offset(1, 0)
Loop

End Sub

It Creates a sheet and copies the data over as you have indicated in your
question. It does however assume that your data will be exactly as you
indicated in your question with 4 text and 11 numbers. I hope that will be
OK. I trust that this is a little better than my ramblings of yesterday.

HTH
 
K

Karaman

Jim,

Thank you very help for your help. I really appreciate the effort. Now I
can process a lot of data easily.

Best regards,
Karaman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Date subtraction 1
Trouble with Clear Contents Macro 9
Arriving at totals 2
Gears 14
Paragraph numbering in Word 1
Compute percentage 1
Compute percentages 2
Finding the right style field in VBA 0

Top