![]() |
Insert Row *below* button position - no need to copy formulas
Good Afternoon -
I am trying to program a button to insert a row below the row that the button is in, even though that might change. I have no necessity to copy the formulas to the inserted cells. I will give a more detailed explanation; How to make pie - Version 1 - updated 1/1/2006 - *Button to make new row* How to make pancakes - Version 1 -updated 1/1/2006 *Button to make new row* How to make ice cream - Version 1 - updated 1/1/2006 *Button to make new row* After I've entered a new version of How to Make Pie - the button for How to make pancakes has moved down, and would no longer insert a row below if i specify where it should insert. Is there a way to say, "insert a row from where this button is" instead of "insert a row from where the cursor is? (obviously not the real project, can you tell I'm hungry?) Thank you for any help you can provide. Katie |
Insert Row *below* button position - no need to copy formulas
This will do it:
In each CommandButton_Click code put this Private Sub CommandButton1_Click() BRow = Sheet1.CommandButton1.TopLeftCell.Row InsertRow End Sub Private Sub CommandButton2_Click() BRow = Sheet1.CommandButton2.TopLeftCell.Row InsertRow End Sub Private Sub CommandButton3_Click() BRow = Sheet1.CommandButton3.TopLeftCell.Row InsertRow End Sub etc for each button. Then in a standard code module put this: Public BRow As Long Sub InsertRow() Sheet1.Rows(BRow + 1).Insert Shift:=xlDown End Sub Mike F "Katie" wrote in message ... Good Afternoon - I am trying to program a button to insert a row below the row that the button is in, even though that might change. I have no necessity to copy the formulas to the inserted cells. I will give a more detailed explanation; How to make pie - Version 1 - updated 1/1/2006 - *Button to make new row* How to make pancakes - Version 1 -updated 1/1/2006 *Button to make new row* How to make ice cream - Version 1 - updated 1/1/2006 *Button to make new row* After I've entered a new version of How to Make Pie - the button for How to make pancakes has moved down, and would no longer insert a row below if i specify where it should insert. Is there a way to say, "insert a row from where this button is" instead of "insert a row from where the cursor is? (obviously not the real project, can you tell I'm hungry?) Thank you for any help you can provide. Katie |
All times are GMT +1. The time now is 09:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com