selecting cell under a button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am running a macro from a button that inserts a new row and copies the
formulas from the row above into it, but when doing this i need to specify an
active cell at the point at which the new row is inseted. is it possible that
i can insert code that selects the cell the button is on top of?

Thankyou
 
Absolutely. The button is not part of the cell but floating on a layer above
the cell.

Mike F
 
You are not giving much detail, but if the button is covering cell A10 then
code
Range("A10"). Select
will select the cell.

Mike F
 
Assuming it is a forms button, and it is called myButton, then use

ActiveSheet.Buttons("myButton").TopLeftCell.EntireRow.Insert


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Bob, assuming i would have to replace "mybutton" with the name of the button
is there a way of the just using the button i have just pressed.

thankyou
 
If you mean in the macro assigned to the button(s)

s = Application.Caller
ActiveSheet.Buttons(s).TopLeftCell.EntireRow.Insert
 
Thats done it Tom, thank you all for your help

Tom Ogilvy said:
If you mean in the macro assigned to the button(s)

s = Application.Caller
ActiveSheet.Buttons(s).TopLeftCell.EntireRow.Insert
 
Back
Top