ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro when Inserting Line (https://www.excelbanter.com/excel-programming/342677-macro-when-inserting-line.html)

T De Villiers[_4_]

Macro when Inserting Line
 

Hi, I need a macro whereby:

When I insert a line the formulae from the rows above are copied down,

Many Thanks


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=475771


Dave Peterson

Macro when Inserting Line
 
David McRitchie has one you could review at:
http://www.mvps.org/dmcritchie/excel/insrtrow.htm
look for: InsertRowsAndFillFormulas

T De Villiers wrote:

Hi, I need a macro whereby:

When I insert a line the formulae from the rows above are copied down,

Many Thanks

--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=475771


--

Dave Peterson

JNW

Macro when Inserting Line
 
Below just inserts a row and copies the formulas from the above row and moves
it down.

Sub copyrow()
Rows("2:2").Insert Shift:=xlDown
Rows("1:1").Copy
Rows("2:2").PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
End Sub

You could use
Selection.Insert Shift:=xlDown
In the first row if you want to first select the row you would like inserted
and then run the macro.


"T De Villiers" wrote:


Hi, I need a macro whereby:

When I insert a line the formulae from the rows above are copied down,

Many Thanks


--
T De Villiers
------------------------------------------------------------------------
T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
View this thread: http://www.excelforum.com/showthread...hreadid=475771




All times are GMT +1. The time now is 11:19 AM.

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