ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert Row & Copy Formula (https://www.excelbanter.com/excel-programming/385409-insert-row-copy-formula.html)

Karen McKenzie

Insert Row & Copy Formula
 
Could someone please help me with the code to insert a row below the current
row and copy the formula in named range ("Telephone") into the new row

joel

Insert Row & Copy Formula
 
Sub insertrow()

Set telephone = Range("I114")

Range(Cells(ActiveCell.Row + 1, ActiveCell.Column), _
Cells(ActiveCell.Row + 1, ActiveCell.Column + 1)). _
EntireRow.Insert Shift:=xlDown

Cells(ActiveCell.Row + 1#, ActiveCell.Column).Formula = telephone.Formula

End Sub
"Karen McKenzie" wrote:

Could someone please help me with the code to insert a row below the current
row and copy the formula in named range ("Telephone") into the new row


Tom Ogilvy

Insert Row & Copy Formula
 
Based on the brevity and lack of specificity in your post, many assumptions
are made:

Is telephone a single cell?

Activecell.offset(1,0).EntireRow.Insert
Activecell.offset(1,0).Formula = Range("Telephone").formula

if Telephone contains a formula that should be copied to allow relative
references to adjust:

Activecell.offset(1,0).EntireRow.Insert
Range("Telephone").copy ActiveCell.offset(1,0)

--
Regards,
Tom Ogilvy


"Karen McKenzie" wrote:

Could someone please help me with the code to insert a row below the current
row and copy the formula in named range ("Telephone") into the new row



All times are GMT +1. The time now is 12:22 AM.

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