ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Use macro to write formula (https://www.excelbanter.com/excel-discussion-misc-queries/235845-use-macro-write-formula.html)

nc

Use macro to write formula
 
I have data in the following format,

A B C D

1 Dept Qty Price Sales (Qty*Price)
2
3

1. I have a formula in column D, how can I use macro to automatically enter
the formula whenever I insert a row, e.g between row 1 and 2. Plus it will
be useful to have the macro update the formula column whenever I add new rows
at the f bottom of the list i.e in row 4.

2. Since this list will be use to enter data I would prefer not to protect
the sheet.
How can I can get macro to rewrite the formula in column D to the bottom of
the list, each time the sheet recalculates, just in case it was accidentally
deleted.








Shane Devenshire[_2_]

Use macro to write formula
 
Hi,

Suppose you have only the first row filled in below the titles, and assume
these are on rows 1 and 2. Select the range A1:D2 and in Excel 2003 choose
Data, List, Create List or in 2007 choose Home, Format as Table, OK.

Now when you add a new row of data the formula will automatically be added,
no macro needed.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"nc" wrote:

I have data in the following format,

A B C D

1 Dept Qty Price Sales (Qty*Price)
2
3

1. I have a formula in column D, how can I use macro to automatically enter
the formula whenever I insert a row, e.g between row 1 and 2. Plus it will
be useful to have the macro update the formula column whenever I add new rows
at the f bottom of the list i.e in row 4.

2. Since this list will be use to enter data I would prefer not to protect
the sheet.
How can I can get macro to rewrite the formula in column D to the bottom of
the list, each time the sheet recalculates, just in case it was accidentally
deleted.









All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com