![]() |
Calling a Macro from multiple places in Excel sheet
I am using Excel 2003. I have a worksheet with multiple pictures in it. When
any of the pictures are clicked, a macro is called. I cannot figure out how to determine which picture was clicked to call the macro. Any help would be appreciated. I apologize if this is a question from VBA101. I'm kinda slow. :) |
Calling a Macro from multiple places in Excel sheet
Hi,
Parent.Caller will give the name of the picture that called the macro Mike "Robert Reid" wrote: I am using Excel 2003. I have a worksheet with multiple pictures in it. When any of the pictures are clicked, a macro is called. I cannot figure out how to determine which picture was clicked to call the macro. Any help would be appreciated. I apologize if this is a question from VBA101. I'm kinda slow. :) |
Calling a Macro from multiple places in Excel sheet
I think Mike meant Application.caller.
Option Explicit sub testme() 'assigned to all the pictures Dim myPict as picture set mypict = activesheet.pictures(application.caller) msgbox mypict.name & vblf & mypict.topleftcell.address ' end wub Mike H wrote: Hi, Parent.Caller will give the name of the picture that called the macro Mike "Robert Reid" wrote: I am using Excel 2003. I have a worksheet with multiple pictures in it. When any of the pictures are clicked, a macro is called. I cannot figure out how to determine which picture was clicked to call the macro. Any help would be appreciated. I apologize if this is a question from VBA101. I'm kinda slow. :) -- Dave Peterson |
Calling a Macro from multiple places in Excel sheet
Thanks for the response. And, like I said, VBA101. :)
"Mike H" wrote: Hi, Parent.Caller will give the name of the picture that called the macro Mike "Robert Reid" wrote: I am using Excel 2003. I have a worksheet with multiple pictures in it. When any of the pictures are clicked, a macro is called. I cannot figure out how to determine which picture was clicked to call the macro. Any help would be appreciated. I apologize if this is a question from VBA101. I'm kinda slow. :) |
Calling a Macro from multiple places in Excel sheet
Dave,
Parent.caller works fine for me Mike "Dave Peterson" wrote: I think Mike meant Application.caller. Option Explicit sub testme() 'assigned to all the pictures Dim myPict as picture set mypict = activesheet.pictures(application.caller) msgbox mypict.name & vblf & mypict.topleftcell.address ' end wub Mike H wrote: Hi, Parent.Caller will give the name of the picture that called the macro Mike "Robert Reid" wrote: I am using Excel 2003. I have a worksheet with multiple pictures in it. When any of the pictures are clicked, a macro is called. I cannot figure out how to determine which picture was clicked to call the macro. Any help would be appreciated. I apologize if this is a question from VBA101. I'm kinda slow. :) -- Dave Peterson . |
Calling a Macro from multiple places in Excel sheet
Yes, it does.
In this case, the parent is the application. I don't think I've ever seen or used it in this way. Mike H wrote: Dave, Parent.caller works fine for me Mike "Dave Peterson" wrote: I think Mike meant Application.caller. Option Explicit sub testme() 'assigned to all the pictures Dim myPict as picture set mypict = activesheet.pictures(application.caller) msgbox mypict.name & vblf & mypict.topleftcell.address ' end wub Mike H wrote: Hi, Parent.Caller will give the name of the picture that called the macro Mike "Robert Reid" wrote: I am using Excel 2003. I have a worksheet with multiple pictures in it. When any of the pictures are clicked, a macro is called. I cannot figure out how to determine which picture was clicked to call the macro. Any help would be appreciated. I apologize if this is a question from VBA101. I'm kinda slow. :) -- Dave Peterson . -- Dave Peterson |
All times are GMT +1. The time now is 03:02 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com