ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TopLeftCell.Address for buttons from forms toolbar (https://www.excelbanter.com/excel-programming/345332-topleftcell-address-buttons-forms-toolbar.html)

Andy

TopLeftCell.Address for buttons from forms toolbar
 
Hi All

Is there an equivalent of:

Set rng = Range(ActiveSheet.Buttons(Application.Caller). _
TopLeftCell.Address)

for buttons from forms toolbar?

Cheers

Andy

Dick Kusleika[_2_]

TopLeftCell.Address for buttons from forms toolbar
 
Andy wrote:
Hi All

Is there an equivalent of:

Set rng = Range(ActiveSheet.Buttons(Application.Caller). _
TopLeftCell.Address)

for buttons from forms toolbar?


Set rng = ActiveSheet.Buttons(Application.Caller).TopLeftCel l

works for me.


--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com




Norman Jones

TopLeftCell.Address for buttons from forms toolbar
 
Hi Andy,

Is there an equivalent of:

Set rng = Range(ActiveSheet.Buttons(Application.Caller). _
TopLeftCell.Address)

for buttons from forms toolbar?


That assignment statement *is* for a button from the Forms tool bar.


If you want to set the range from a Controls Toolbox button, try:

'==============
Private Sub CommandButton1_Click()
Dim rng As Range

Set rng = Range(Me.CommandButton1.TopLeftCell.Address)
End Sub
'<<==============


---
Regards,
Norman



"Andy" wrote in message
...
Hi All

Is there an equivalent of:

Set rng = Range(ActiveSheet.Buttons(Application.Caller). _
TopLeftCell.Address)

for buttons from forms toolbar?

Cheers

Andy




Andy

TopLeftCell.Address for buttons from forms toolbar
 
Thanks Norman and Dick, it's 4pm on Friday, thats my excuse. I meant it
the other way around, should have been is there an equivalent for
controls toolbox button.

Norman Jones wrote:
Hi Andy,


Is there an equivalent of:

Set rng = Range(ActiveSheet.Buttons(Application.Caller). _
TopLeftCell.Address)

for buttons from forms toolbar?



That assignment statement *is* for a button from the Forms tool bar.


If you want to set the range from a Controls Toolbox button, try:

'==============
Private Sub CommandButton1_Click()
Dim rng As Range

Set rng = Range(Me.CommandButton1.TopLeftCell.Address)
End Sub
'<<==============


---
Regards,
Norman



"Andy" wrote in message
...

Hi All

Is there an equivalent of:

Set rng = Range(ActiveSheet.Buttons(Application.Caller). _
TopLeftCell.Address)

for buttons from forms toolbar?

Cheers

Andy






All times are GMT +1. The time now is 04:56 PM.

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