![]() |
Macro to Insert a row and copy Formulae
All.
I want to write a macro to insert a row at the cell pointer. Check that the first cell is in column A and then copy a row of formulae into the new blank row. I have hacked together the following. It quite happily inserts the row and moves to column A but it only copies the formula row onto itself. I think that I need to record the active cell (Column A of the inserted row) and then paste the Formula row into it, but I've no idea where to start. No need to give me the code, just point me in the right direction and I'll try to work out the rest myself. This is a learning opportunity Sub InsertRowAndPasteFormulae() ' ' Macro to Insert Row and Copy Formulae ' Macro prepared on 02/02/2006 by Philip.Smith ' Selection.End(xlToLeft).Select Selection.EntireRow.Insert ActiveCell.Activate Range("PP_Acc_Formulae").Copy Range("PP_Acc_Formulae").PasteSpecial xlPasteFormulas End Sub Kind regards Phil Smith |
Macro to Insert a row and copy Formulae
Hi Don.
Forget last I've sussed it sorry for being thick!!! "Don Guillett" wrote: one way Sub insertrowandformularow() ActiveCell.EntireRow.Insert Rows(1).Copy Rows(ActiveCell.Row) End Sub -- Don Guillett SalesAid Software "Philip J Smith" wrote in message ... All. I want to write a macro to insert a row at the cell pointer. Check that the first cell is in column A and then copy a row of formulae into the new blank row. I have hacked together the following. It quite happily inserts the row and moves to column A but it only copies the formula row onto itself. I think that I need to record the active cell (Column A of the inserted row) and then paste the Formula row into it, but I've no idea where to start. No need to give me the code, just point me in the right direction and I'll try to work out the rest myself. This is a learning opportunity Sub InsertRowAndPasteFormulae() ' ' Macro to Insert Row and Copy Formulae ' Macro prepared on 02/02/2006 by Philip.Smith ' Selection.End(xlToLeft).Select Selection.EntireRow.Insert ActiveCell.Activate Range("PP_Acc_Formulae").Copy Range("PP_Acc_Formulae").PasteSpecial xlPasteFormulas End Sub Kind regards Phil Smith |
Macro to Insert a row and copy Formulae
Hi Don.
Thanks for this, but where does this select the row containing the formulae and copy it into the new blank row? Sorry, If I've missed it. Regards "Don Guillett" wrote: one way Sub insertrowandformularow() ActiveCell.EntireRow.Insert Rows(1).Copy Rows(ActiveCell.Row) End Sub -- Don Guillett SalesAid Software "Philip J Smith" wrote in message ... All. I want to write a macro to insert a row at the cell pointer. Check that the first cell is in column A and then copy a row of formulae into the new blank row. I have hacked together the following. It quite happily inserts the row and moves to column A but it only copies the formula row onto itself. I think that I need to record the active cell (Column A of the inserted row) and then paste the Formula row into it, but I've no idea where to start. No need to give me the code, just point me in the right direction and I'll try to work out the rest myself. This is a learning opportunity Sub InsertRowAndPasteFormulae() ' ' Macro to Insert Row and Copy Formulae ' Macro prepared on 02/02/2006 by Philip.Smith ' Selection.End(xlToLeft).Select Selection.EntireRow.Insert ActiveCell.Activate Range("PP_Acc_Formulae").Copy Range("PP_Acc_Formulae").PasteSpecial xlPasteFormulas End Sub Kind regards Phil Smith |
All times are GMT +1. The time now is 10:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com