Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert row and copy formulas Hugh Excel Discussion (Misc queries) 5 September 25th 09 05:28 PM
Macro: Insert Blank Row with formulas uses absolute position probl steveb Excel Discussion (Misc queries) 1 June 18th 09 08:08 PM
insert row above button (retrieve position of button) Max Excel Discussion (Misc queries) 3 November 7th 07 06:27 PM
Macro to insert copy and insert formulas only to next blank row bob Excel Programming 0 June 30th 06 12:02 PM
Insert Row and copy formulas Alan Excel Programming 4 February 22nd 04 06:26 PM


All times are GMT +1. The time now is 03:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"