I have a set string of data, and if inside Column N the vale of 18 is seen, i would like Excel to insert a new row directly below it, so that I can use the new line after that. What would the macro / formula I need to insert. This type of programming is foreign but want to learn. Version I am using is Excel 2013, if it makes a difference.

message edited by Tigermafia

Hi, I dont completely understand what you are asking, but here is what i think you are asking for from what i read. You want to go through the entire column 'N', and if the value in N is 18, then you want a new row inserted below it? if this is correct then the below code will achieve this.

Dim URange, LRange Dim BCell As Range Sub InsertNewRow() Set URange = Range("N1") Set LRange = Range("N" & Rows.Count).End(xlUp) For Each BCell In Range(URange, LRange) If Val(BCell.Value) = 18 Then BCell.Offset(1).EntireRow.Insert End If Next BCell End Sub

Ask Your Question

Weekly Poll