Adding a formula to a Blank Row Insertion Loop

johnnyb5

Board Regular
Joined
Dec 23, 2014
Messages
89
I'm using the below VBA to add a blank row where my data changes in my sheet. The Instruction is working fine. However, I'm trying to add a formula into the blank line that this code creates in column "C" of the inserted row.

When I added the working formula to the code after the "insert" instruction it only inserted one formula and did not continue to insert the formulas at each blank row added.

For i = WorkRng.Rows.Count To 2 Step -1
If WorkRng.Cells(i, 1).Value <> WorkRng.Cells(i - 1, 1).Value Then
WorkRng.Cells(i, 1).EntireRow.Insert

End If
Next

The working formula that I've been trying to add is:
"=IF(R[0]C[-2] > 0,"""",INDEX(ECC!R1C2:R27C2,MATCH(R[1]C[-2],ECC!C[-2],0)))"

Would anyone know how to include the insertion of a formula into the blank row insertion loop?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,216,031
Messages
6,128,422
Members
449,450
Latest member
gunars

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