ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting cell under a button (https://www.excelbanter.com/excel-programming/396518-selecting-cell-under-button.html)

Patrick Bateman

selecting cell under a button
 
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

Mike Fogleman

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

Mike F
"Patrick Bateman" wrote in
message ...
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




Patrick Bateman

selecting cell under a button
 
is that absolutely not or absolutely? if it i possible, any idea how?


"Mike Fogleman" wrote:

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

Mike F
"Patrick Bateman" wrote in
message ...
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





Mike Fogleman

selecting cell under a button
 
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
"Patrick Bateman" wrote in
message ...
is that absolutely not or absolutely? if it i possible, any idea how?


"Mike Fogleman" wrote:

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

Mike F
"Patrick Bateman" wrote in
message ...
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







Bob Phillips

selecting cell under a button
 
Assuming it is a forms button, and it is called myButton, then use

ActiveSheet.Buttons("myButton").TopLeftCell.Entire Row.Insert


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Patrick Bateman" wrote in
message ...
is that absolutely not or absolutely? if it i possible, any idea how?


"Mike Fogleman" wrote:

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

Mike F
"Patrick Bateman" wrote in
message ...
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







Patrick Bateman

selecting cell under a button
 
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

"Bob Phillips" wrote:

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

ActiveSheet.Buttons("myButton").TopLeftCell.Entire Row.Insert


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Patrick Bateman" wrote in
message ...
is that absolutely not or absolutely? if it i possible, any idea how?


"Mike Fogleman" wrote:

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

Mike F
"Patrick Bateman" wrote in
message ...
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







Tom Ogilvy

selecting cell under a button
 
If you mean in the macro assigned to the button(s)

s = Application.Caller
ActiveSheet.Buttons(s).TopLeftCell.EntireRow.Inser t

--
Regards,
Tom Ogilvy


"Patrick Bateman" wrote:

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

"Bob Phillips" wrote:

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

ActiveSheet.Buttons("myButton").TopLeftCell.Entire Row.Insert


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Patrick Bateman" wrote in
message ...
is that absolutely not or absolutely? if it i possible, any idea how?


"Mike Fogleman" wrote:

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

Mike F
"Patrick Bateman" wrote in
message ...
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







Patrick Bateman

selecting cell under a button
 
Thats done it Tom, thank you all for your help

"Tom Ogilvy" wrote:

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

s = Application.Caller
ActiveSheet.Buttons(s).TopLeftCell.EntireRow.Inser t

--
Regards,
Tom Ogilvy


"Patrick Bateman" wrote:

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

"Bob Phillips" wrote:

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

ActiveSheet.Buttons("myButton").TopLeftCell.Entire Row.Insert


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Patrick Bateman" wrote in
message ...
is that absolutely not or absolutely? if it i possible, any idea how?


"Mike Fogleman" wrote:

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

Mike F
"Patrick Bateman" wrote in
message ...
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








All times are GMT +1. The time now is 10:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com