Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Identifying Button Clicked

Assume these are buttons from the forms toolbar

Sub Btn_click()
Dim btn as Button
set btn = Activesheet.Buttons(Application.Caller)
rw = btn.topLeftCell.row

End Sub

Application.Caller returns the name (a string) of the button triggering the
macro.

--
Regards,
Tom Ogilvy

"Mister T" <Mister wrote in message
...
I have on a spreadsheet several buttons that trigger the same macro. Let's

say one of the buttons is in row 1, another in row 3, another in row 5, etc.
If the row 1 button is clicked, I want the macro to act on row 1; if the row
3 button is clicked, I want the macro to act on row 3; etc. Therefore, I
need the macro to "know" which one of the buttons called it. Can that be
done, and how? Thanks.


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
Macro button gets bigger when clicked Snowskier Excel Discussion (Misc queries) 1 May 27th 10 09:36 PM
let a sub recognise the name of the button that has been clicked. Brotherwarren Excel Discussion (Misc queries) 2 March 18th 06 10:56 AM
Identifying Button Clicked Chip Pearson Excel Programming 0 July 23rd 04 06:29 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM
Button event clicked problem Marek Cvrk Excel Programming 2 October 14th 03 05:47 PM


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