Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet Button Callbacks

I have embedded several buttons within different cells of
an Excel worksheet, all of which reference the same
procedure upon clicking. Within the procedure I need to
determine the cell location (BottomRightCell or
TopLeftCell.. I think) of that button. Have searched
knowledge base, Micorsoft help and text books to no avail.

Any thoughts?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Worksheet Button Callbacks

If you mean buttons from the forms toolbar, and if you don't it is far
easier to do this with those buttons, you would use Application.Caller

Sub Button_Click()
sName = Application.Caller
set btn = Activesheet.Buttons(sName)
set rng = btn.TopLeftCell
msgbox "you pressed " & sname & vbnewline & _
"located above cell: " & rng.address
End Sub

Then assign this macro to each of your buttons from the forms toolbar.

Regards,
Tom Ogilvy


"Mike Lynch" wrote in message
...
I have embedded several buttons within different cells of
an Excel worksheet, all of which reference the same
procedure upon clicking. Within the procedure I need to
determine the cell location (BottomRightCell or
TopLeftCell.. I think) of that button. Have searched
knowledge base, Micorsoft help and text books to no avail.

Any thoughts?



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
go to worksheet on button name Northern Dave New Users to Excel 1 November 4th 08 12:04 PM
Moving a button on worksheet Jock Excel Worksheet Functions 5 November 2nd 07 03:50 PM
How do I put a toolbar button into a worksheet? Diamond1974 Excel Worksheet Functions 1 November 16th 06 01:41 PM
How can I use the tab button after protecting the worksheet? Joanne, BC Excel Worksheet Functions 2 December 6th 05 09:44 PM
print different worksheet by pressing visible button on worksheet Confused Excel Worksheet Functions 2 June 13th 05 02:22 PM


All times are GMT +1. The time now is 09:16 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"