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

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,216,269
Messages
6,129,813
Members
449,538
Latest member
cookie2956

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