MACRO - INSERT ROW

  • Thread starter Thread starter Chantelle
  • Start date Start date
C

Chantelle

Hi All,
I would like to create a macro with a box that allows the user to insert a
row by pressing the button. I have done this once before but many years ago
and I had a training book! Can someone help me? I know it is fairly simple
but I rarely use macros and I am not sure how to write the code.
Thanks
Chantelle
 
Hi All,
I would like to create a macro with a box that allows the user to insert a
row by pressing the button.  I have done this once before but many years ago
and I had a training book! Can someone help me? I know it is fairly simple
but I rarely use macros and I am not sure how to write the code.
Thanks
Chantelle

Hi Chantelle,

This should do it for you. Attach it to a button or set it to a hotkey
under the macro options.

Steven

Sub InsRw()
Dim Rng as Range

Set Rng = ActiveCell.EntireRow

Rng.Insert Shift:=xlDown
Set Rng = Rng.Offset(1,0)
Rng.Select

End Sub
 
As a general rule of thumb, Chantelle, try this: Start recording a macro.
(Don't worry about the name and the comments, just rush on by that because
you won't be using them afterward.) Do the task you're trying to program.
Then stop recording the macro and go look at what was recorded in the macro.
You can almost always use what you see there, usually with some modification
but nothing very complicated.

Anything you don't understand in the macro, post a question here and ask
about THAT. You'll probably end up understanding more that way, and able to
do more for yourself and more quickly as a result.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top