ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Editing Marco (https://www.excelbanter.com/excel-programming/413810-editing-marco.html)

JBoyer

Editing Marco
 
This is the formula I was reccomended by another user and it does everything
I asked for except I have one new request. This is the marco I now am using:
Sub InsertFiveRows()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
v = Rows(LastRow - 1).Formula
Cells(LastRow - 1, "A").Resize(5, 1).EntireRow.Insert
Rows(LastRow - 1) = v
Rows(LastRow + 4).ClearContents
Range("AU1:BF5").Copy Cells(LastRow, "A")
End Sub

I want this to also drag down the formula in the M column five rows


JR Form[_2_]

Editing Marco
 
Use the same code just make a few M changes-
Add this to the bottom of your current macro.

Dim LastRowM As Long
Dim vM As Variant
LastRow = Cells(Rows.Count, "M").End(xlUp).Row
vM = Rows(LastRow - 1).Formula
Cells(LastRow - 1, "M").Resize(5, 1).EntireRow.Insert
Rows(LastRow - 1) = vM
Rows(LastRow + 4).ClearContents
Range("AU1:BF5").Copy Cells(LastRow, "M")


"JBoyer" wrote:

This is the formula I was reccomended by another user and it does everything
I asked for except I have one new request. This is the marco I now am using:
Sub InsertFiveRows()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
v = Rows(LastRow - 1).Formula
Cells(LastRow - 1, "A").Resize(5, 1).EntireRow.Insert
Rows(LastRow - 1) = v
Rows(LastRow + 4).ClearContents
Range("AU1:BF5").Copy Cells(LastRow, "A")
End Sub

I want this to also drag down the formula in the M column five rows



All times are GMT +1. The time now is 06:53 AM.

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