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

I  want to put in a button that just inserts a new row above row 2

TIMFOX123Asked:
Who is Participating?
 
StephenJRCommented:
Range("A2").EntireRow.Insert
0
 
sah18Commented:
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:

http://office.microsoft.com/en-us/excel-help/add-a-button-and-assign-a-macro-to-it-in-a-worksheet-HP010236676.aspx

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!
0
 
StephenJRCommented:
Thanks sah18, missed that. Basically right-click the button and assign macro.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Rob HensonFinance AnalystCommented:
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.

Cheers
Rob H
0
 
Saqib Husain, SyedEngineerCommented:
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.

Saqib


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()
[2:2].Insert
End Sub

Open in new window

0
 
TIMFOX123Author Commented:
Great job

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

thx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.