Insert rows below (with formulas and formatting) based upon a cell variable

LEWI_74

New Member
Joined
Apr 24, 2008
Messages
46
Good morning,

I have searched the forum for an answer to this question, but although there are some close answers, I can't quite comprehend (VBA novice) how to use the code in my scenario.

Using Excel 2016:


I have the following whereby the results are feeding from an adjoining sheet.

I am after a variable number of rows (including formulas and formatting) to be added below row 20 based on the number in C15 (formula driven). For info, lines 16 & 17 are hidden.

The initial 2 lines are standard on each tab and is the minimum standardtemplate number.

Rows 19 and 20 contains the formulas that need to be copied down. The formulas are all consistent based on the flag number in Column A (cell above + 1). The data will then populate B19:F20 based on formulas and formatting.


When the number in cell C15 is changed, in this example to 6, 4 additional lines need to be added in, with formulas and formatting.

Many thanks for any assistance

David

From:
Row A B C D E F
15 Number of lines 2
18 Line Company Cost Account Debit Credit
19 1 1110 11100003 60088000 100
20 2 1110 11100006 60089000 100

To:
Row A B C D E F
15 Number of lines 6
18 Line Company Cost Account Debit Credit
19 1 1110 11100003 60088000 100
20 2 1110 11100006 60089000 100
21 3 1110 11100003 50001000 3500
22 4 1110 11100006 21715000 3500
23 5 1110 11100003 50001000 4000
24 6 1110 11100006 21715000 4000
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,621
Messages
6,120,568
Members
448,972
Latest member
Shantanu2024

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