Excel - macro to lookup cell and add new row

December 2016




Issue


I want to create a macro which will look at for example column A and find the last number entered then add a row below it and to do this every time its ran.

Solution


You can use this macro :


Sub Insert_Row() 
Dim n As Integer 
n = Cells(Rows.Count, 1).End(xlUp).Row  
    Rows(n).Select 
    Selection.Insert Shift:=xlUp 
End Sub

Note


Thanks to aquarelle for this tip on the forum.

Related :

This document entitled « Excel - macro to lookup cell and add new row » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.