in excell I want to put in a button to insert a row

Posted on 2011-04-21
Last Modified: 2012-05-11
I  want to put in a button that just inserts a new row above row 2

Question by:TIMFOX123
    LVL 24

    Accepted Solution

    LVL 9

    Assisted Solution

    Here is a step-by-step tutorial on how to insert a button into an Excel worksheet and then to assign a macro to it:

    The macro is the behavior that will occur when the button is clicked.  StephenJR has already provided the macro information that should work.

    Hope this helps!
    LVL 24

    Expert Comment

    Thanks sah18, missed that. Basically right-click the button and assign macro.
    LVL 31

    Assisted Solution

    by:Rob Henson
    There is a standard button available for inserting rows.

    In Excel 2003 - Right click on the toolbars and Select Customize. In the left hand pane select Insert and the right hand pane will change to show all buttons available, one of which is Insert Row.

    Drag the Insert Rows button option to a tool bar.

    Click Close. Job Done. This will then show for all files and will insert a row above the active row so if you specifically want it above row 2, ensure the active cell is in row 2 when clicking the button.

    Rob H
    LVL 43

    Expert Comment

    by:Saqib Husain, Syed
    While there are suggestions here is my innovative one. Although it appears a bit clumsy but I think it is just right for your scenario.

    Insert this macro in the workbook module for the worksheet and change the second line to accommodate the name of your worksheet. Save the file, close it and open it.

    This will create a triangle at the left edge of the worksheet which is not printable. Clicking on this triangle will insert a row at row 2.


    Private Sub Workbook_Open()
    Set sh = Sheets("sheet1")
    For Each shp In sh.Shapes
    If Right(shp.OnAction, 23) = "ThisWorkbook.inslineat2" Then shp.Delete
    Next shp
    Set a = sh.Shapes.AddShape(msoShapeIsoscelesTriangle, 0, 0, 5, [a1].Height)
    a.OnAction = "ThisWorkbook.inslineat2"
    a.Rotation = 180
    a.OLEFormat.Object.PrintObject = False
    a.Fill.ForeColor.SchemeColor = 8
    a.Fill.Visible = msoTrue
    a.Line.Visible = msoFalse
    End Sub
    Sub inslineat2()
    End Sub

    Open in new window


    Author Closing Comment

    Great job

    Actually I pretty much knew how to do this in the old excel,   the new excel is so different


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Suggested Solutions

    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…
    How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
    This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
    This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

    732 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

    17 Experts available now in Live!

    Get 1:1 Help Now