Consilidate VBA and insert row

tlindeman

Active Member
Joined
Jun 29, 2005
Messages
313
Good Morning,
I have three tabs: CB PAID CB Partial CB Unpaid. What I would like to do is copy all the data from all three and paste into a tab called consilidated. The number of rows in each tab will vary each month. So I would like to paste into a blank row in the consilidated tab. Then after that is complete, I would like to insert a row every 10,000 rows so I can create a pivot table. I am using excel 2010. Please supply the VBA Thank you in advance.

Tony
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Good Morning,
I have three tabs: CB PAID CB Partial CB Unpaid. What I would like to do is copy all the data from all three and paste into a tab called consilidated. The number of rows in each tab will vary each month. So I would like to paste into a blank row in the consilidated tab. Then after that is complete, I would like to insert a row every 10,000 rows so I can create a pivot table. I am using excel 2010. Please supply the VBA Thank you in advance.

Tony

Does this help in any way? Untested, use on a copy first.

Code:
 Sub tlindeman()
 Dim x As String
 Dim lr As Long
 Dim lr2 As Long
 Dim i As Long
 Dim i2 As Long
 
 lr = Cells(Rows.Count, 1).End(xlUp).Row
 lr2 = Sheets("Consolidated").Cells(Rows.Count, 1).End(xlUp).Row
 
 x = Array("CB PAID", "CB Partial", "CB Unpaid")
 
 For i = LBound(x) To UBound(x)
 
    Sheets(i).Range(Range("A2"), Range("A" & lr)).EntireRow.Copy Sheets("Consolidated").Range("A" & Rows.Count).End(3)(2)
 
 Next i
 
 With Sheets("Consolidated")
 
 For i2 = lr2 To 2 Step 10000
     
     Rows(i2).EntireRow.Insert shift:=xlUp
        
 Next i2
 
 End With
 
 End Sub
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,874
Members
452,949
Latest member
Dupuhini

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