Before you flag this, please note that I need to amend Existing code to be able to fit multiple cases. I have:
I need to amend this to add the following functionality:
1. Rows need to be added in worksheet titled "Location File Data", with the date reference column as the qualifier being "AN".
2. Be able to let me specify what the previous value to look for and next value changed to should be. Insert rows where this change happens. IE, there are rows of data for 2017, 2016, 2015, 2014 and 2013 respectively. I want the code to let me specify whether to look for the spot where 2017 data ends and 2016 begins, or where 2015 ends and 2014 begins, etc... I would rather this not be by prompt, but rather by a reference to a cell in a sheet titled "Compare" which contains the number of rows to insert
Code:
Sub InsertRowAtChangeInValue()
Dim lRow As Long
For lRow = Cells(Cells.Rows.Count, "AN").End(xlUp).Row To 2 Step -1
If Cells(lRow, "AN") <> Cells(lRow - 1, "AN") Then Rows(lRow).EntireRow.Insert
Next lRow
End Sub
I need to amend this to add the following functionality:
1. Rows need to be added in worksheet titled "Location File Data", with the date reference column as the qualifier being "AN".
2. Be able to let me specify what the previous value to look for and next value changed to should be. Insert rows where this change happens. IE, there are rows of data for 2017, 2016, 2015, 2014 and 2013 respectively. I want the code to let me specify whether to look for the spot where 2017 data ends and 2016 begins, or where 2015 ends and 2014 begins, etc... I would rather this not be by prompt, but rather by a reference to a cell in a sheet titled "Compare" which contains the number of rows to insert