Solved

Macro to insert specific row BELOW selected cell

Posted on 2011-02-16
3
530 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

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

Accepted Solution

by:
Ingeborg Hawighorst (Microsoft MVP / EE MVE) 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

739 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