Copy-Paste Issue

Boris7265

Board Regular
Joined
Apr 6, 2011
Messages
68
Hello to all of you.
Here is a problem that I am stuck with on my job. I run every day report from another accounting system in excel format and data on worksheet located like this: one Set of datas are in column A-J of row 1 , and second set of dates are in the columns L to U in row 1 as well .Then in row 2 the same :one set of datas are in the columns A to J and another are in the columns L to U . I am trying to move datas that are in columns L to U to at beginning worksheet to columns A to J . First , I made a macro to insert new blank rows until end of the datas of columns A
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Range("A1").Select<o:p></o:p>
Selection.End(xlDown).Select<o:p></o:p>
Do Until ActiveCell.Row = 1<o:p></o:p>
ActiveCell.EntireRow.Insert Shift:=xlDown<o:p></o:p>
<o:p> </o:p>
ActiveCell.Offset(-1, 0).Select<o:p></o:p>
<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /><st1:place w:st="on">Loop</st1:place>
<o:p> </o:p>
The macro is working , now I need to copy-paste columns L to U onto blank rows that were just entered between rows in columns A to J and delete the datas in columns L to U .The worksheet contains 1000-1500 rows averagely so that copy-paste them manually would be hard . I am green in vb specially excel so any help would ne very helpful and appreciated.
<o:p> </o:p>
Thank you in advance,
<o:p> </o:p>
The Best Regards,
<o:p> </o:p>
BorisGomel
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I think this macro will do what you want faster than the approach you were trying initially...

Code:
Sub BlendAtoJwithLtoU()
  Dim AJ As Variant, LU As Variant, AJLU As Variant, LastRow As Long, Rw As Long, Cl As Long
  LastRow = Cells(Rows.Count, "A").End(xlUp).Row
  AJ = Range("A1:J" & LastRow)
  LU = Range("L1:U" & LastRow)
  ReDim AJLU(1 To 2 * LastRow, 1 To 10)
  For Rw = 1 To LastRow
    For Cl = 1 To 10
      AJLU(2 * Rw - 1, Cl) = AJ(Rw, Cl)
      AJLU(2 * Rw, Cl) = LU(Rw, Cl)
    Next
  Next
  Application.ScreenUpdating = False
  Range("A1:J" & 2 * LastRow) = AJLU
  Columns("L:U").Clear
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you very much sir!
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I have tried your macro and it is really amazing. A thousand thanks.
<o:p> </o:p>
Sir, if I may just one small issue to address here. The datas are joined nicely and between every two rows there are two blanks rows. The problem that I need to delete the two blanks rows that datas should have been in each row. Really appreciate for helping me with it .

BorisGomel
 
Upvote 0
The datas are joined nicely and between every two rows there are two blanks rows. The problem that I need to delete the two blanks rows that datas should have been in each row. Really appreciate for helping me with it.l
Did you merge your posted code with my code? I ask because my code was meant to be the complete code, fully replacing the code you posted. If you just run the code I posted, as is, no blank lines are introduced. At least that is how it works on my sample data.
 
Upvote 0
Got it!!!!
My opps.
Thank you very much Sir!!!
You really easy my job and my deepest regards and appreciation to you!!!

BorisGomel
 
Upvote 0

Forum statistics

Threads
1,224,527
Messages
6,179,337
Members
452,907
Latest member
Roland Deschain

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