0
Thanks

A few words of thanks would be greatly appreciated.

Excel - macro to lookup cell and add new row




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.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Excel - macro to lookup cell and add new row », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!