Solved Inserting a New Row based on data.

August 25, 2013 at 16:26:47
Specs: Windows 7
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

See More: Inserting a New Row based on data.

Report •

August 29, 2013 at 01:56:02
✔ Best Answer

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
        End If
    Next BCell
End Sub

Report •
Related Solutions

Ask Question