• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Simple VBA - insert new row underneath selected cell/row?

Hi

Just a simple VBA request.

I need a bit of code that tells excel to insert a new row underneath the cell that i've selected; let's say I have selected cell A100, I need to press a macro to insert a new row underneath this cell, so a row A101 will have been created (or a new row A101 and previous A101 will be pushed to A102) and then do another bunch of stuff (but I already have the code for this).

Any help would be greatly appreciated.

Thanks!
EJ
 
No worries I worked it out, was pretty simple:

Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveCell.Offset(1).EntireRow.Insert
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(1, 2).Select
ActiveCell.FormulaR1C1 = ActiveCell.Offset(-1) + 1
Thanks anyway!
 

SirJB7

Excel Rōnin
Hi, exceljockey!
Tried doing it in this way?
Selection.Offset(1, 0).EntireRow.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Regards!
 
Top