ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro help. Insert row and copy formulas from row above (https://www.excelbanter.com/excel-programming/423485-macro-help-insert-row-copy-formulas-row-above.html)

Kesbutler

Macro help. Insert row and copy formulas from row above
 
I have a worksheet that I need to insert rows but copy only the formulas from
the row above. Any suggestions?

joel

Macro help. Insert row and copy formulas from row above
 
to copy the last row and maintain your formulas it is best to copy the last
row and insert the copy before the last row. Thne clear the non-formula
cells from the last row. A little backwards, but it will work.


Lastrow = range("A" & rows.Count).end(xlup).Row
Rows(Lastrow).copy
Rows(Lastrow).Insert
Rows(Lastrow + 1).SpecialCells(xlCellTypeConstants).ClearContents



"Kesbutler" wrote:

I have a worksheet that I need to insert rows but copy only the formulas from
the row above. Any suggestions?


Kesbutler

Macro help. Insert row and copy formulas from row above
 
I have following formula working. But the new row is not protected. Is there
a way to have the macro lock the cells with the formula so they cannot be
updated by users?

Thanks

"Kesbutler" wrote:

I have a worksheet that I need to insert rows but copy only the formulas from
the row above. Any suggestions?


Kesbutler

Macro help. Insert row and copy formulas from row above
 
Is there a way to have it copy only the formulas? Also, the workbook will be
password protected.

"Joel" wrote:

to copy the last row and maintain your formulas it is best to copy the last
row and insert the copy before the last row. Thne clear the non-formula
cells from the last row. A little backwards, but it will work.


Lastrow = range("A" & rows.Count).end(xlup).Row
Rows(Lastrow).copy
Rows(Lastrow).Insert
Rows(Lastrow + 1).SpecialCells(xlCellTypeConstants).ClearContents



"Kesbutler" wrote:

I have a worksheet that I need to insert rows but copy only the formulas from
the row above. Any suggestions?



All times are GMT +1. The time now is 06:48 PM.

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