vba to insert rows

timlh42

Board Regular
Joined
Sep 27, 2017
Messages
76
I have a macro that will fill rows of data that match today's date. There will always just be two rows of data that meet this criteria. I would like them to fill rows 2 and 3, because in row 4 I have formulas that will add the data in each column from rows 2 and 3.

I am currently trying to use the following to fill in my blank rows:

DestRow1 = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
DestRow2 = ws2.Cells(Rows.Count, "B").End(xlUp).Row + 1
DestRow3 = ws2.Cells(Rows.Count, "C").End(xlUp).Row + 1
DestRow4 = ws2.Cells(Rows.Count, "D").End(xlUp).Row + 1
DestRow5 = ws2.Cells(Rows.Count, "E").End(xlUp).Row + 1
DestRow6 = ws2.Cells(Rows.Count, "F").End(xlUp).Row + 1
DestRow7 = ws2.Cells(Rows.Count, "G").End(xlUp).Row + 1
DestRow8 = ws2.Cells(Rows.Count, "H").End(xlUp).Row + 1
DestRow9 = ws2.Cells(Rows.Count, "I").End(xlUp).Row + 1
DestRow10 = ws2.Cells(Rows.Count, "J").End(xlUp).Row + 1
DestRow11 = ws2.Cells(Rows.Count, "K").End(xlUp).Row + 1
DestRow12 = ws2.Cells(Rows.Count, "L").End(xlUp).Row + 1

The problem is that it places the new rows directly below the row that has my prepopulated formulas, thus leaving the two rows above still blank.

Is there any other code I could use to fill in the two blank rows?
 
Glad to help & thanks for the feedback
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Forum statistics

Threads
1,215,404
Messages
6,124,715
Members
449,184
Latest member
COrmerod

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