VBA : copy paste rows into column

drakko

New Member
Joined
Apr 26, 2011
Messages
5
Dear all, i just realize that, after spending alot of time, to my horror, the database that i've been working on for weeks cannot display correctly in PIVOT table because the part of the month doesnt put as it should be. manual re-writing the database is not possible because it involved hundreds of thousands rows :(

after trying to do some googling and macro recording, i must admit that i cannot work this out by myself.

i would like to ask dear fellow here, what should i put in my macro, in order to do repetition of :
1. insert new rows
2. copy the rows
3. transpose the row into 1 column in another worksheet
4. move on to the next row
5. rinse and repeat until rows 100.000 something

to make it easier to understand, i have attached to screenshot.

sorry if my English is bad

regards,
Edwin

 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
@rxschin : thanks for your reply, but unfortunately, it's not as simple as that, because from the current 100.000 rows, i must expand it into 1.2mil rows, considering that the months must be put into rows (rather than 12 columns, each column for each month)
 
Upvote 0
@rxschin: thanks for the head up, i tried to delete all the old data, and it left me with 57k rows. (which mean if i spread it into 12 rows, it still only reach approx. 700k rows)

just now i googled *again* for the maximum rows per worksheet, and here's the answer

"
In Excel 2007 the maximum number of rows per worksheet increased to 1,048,576 and the number of columns increased to 16,384 which is column XFD"
 
Upvote 0
@rxschin : thanks for your reply, but unfortunately, it's not as simple as that, because from the current 100.000 rows, i must expand it into 1.2mil rows, considering that the months must be put into rows (rather than 12 columns, each column for each month)

Okay, don't worry about it. I'll see what I can write for you.
 
Last edited:
Upvote 0
this assumes you have a header.

make sure you do this on a COPY of your workbook!!!!
PHP:
Sub Macro1()
'
' Macro1 Macro
'
'
application.screenupdating=false
    For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
    Rows(i).Copy
    Range(Rows(i + 1), Rows(i + 11)).Insert
    Range(Cells(i, 10), Cells(i, 20)).Copy
    Cells(i + 1, 9).Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=True
    Next i
    Range("J:T").ClearContents
application.screenupdating=true
End Sub
 
Upvote 0
@rxschin :

ok, i already run the macro, and still waiting for the result.. maybe will complete in couples of minutes or maybe a few hours...

my bad i didnt try it first on a few sample rows....

but fortunately, my laptop is running on i7 procie
 
Upvote 0
@rxchin :

it works like charm!!! thank you!!! *hugs* :stickouttounge: :biggrin:

fyi, it finally completed in around 1 hour, with physical memory usage at the end around at 65%, making the laptop unable to do simple basic cut paste during the macro-time.

again, thank you for taking your time for this matter
what goes around comes around, i pray that you will also get the same blessing from others in your life. :biggrin:
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top