Solved

Macro to insert specific row BELOW selected cell

Posted on 2011-02-16
3
525 Views
Last Modified: 2012-08-13
Hello,

I was wondering if someone can please have a look at the attached file and fix my little macro accordingly?
Currently it is inserting above the selected/highlighted cell whereas i need it to insert below instead.
The macro is called 'InsertRow'

Any help / suggestions will be greatly appreciated, as you can see i am very new at this!      example.xlsm
0
Comment
Question by:vegas86
  • 2
3 Comments
 

Author Comment

by:vegas86
ID: 34912410
sorry i forgot to attach the file!
example.xlsm
0
 
LVL 50

Accepted Solution

by:
teylyn earned 500 total points
ID: 34912471
Hello,

change these two lines of code from

    Selection.EntireRow.Insert
     
    iRow = ActiveCell.Row

to this


    Selection.Offset(1, 0).EntireRow.Insert
     
    iRow = ActiveCell.Row + 1


cheers, teylyn
0
 

Author Closing Comment

by:vegas86
ID: 34912564
Thank you SO much for the fast reply Teylyn I did what you suggested and it works a treat! you are a gem!!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now