Can you determine which is the "Active" shape usin

sbendbuckeye

Active Member
Joined
Nov 26, 2003
Messages
440
Hello All,

I am creating a series of CheckBoxes in worksheet based on user actions using this command:
Code:
' strAddress, lngLeft and lngTop are all calculated variables.
With Sheet1.Shapes.AddFormControl(xlCheckBox, lngLeft, lngTop, 10, 10)
    With .DrawingObject
        .Caption = vbNullString
        .LinkedCell = strAddress
    End With
    .Name = "chk" & UCase$(strAddress)
    .OnAction = "CheckBox_Click"
End With
I want to use a generic CheckBox_Click method to handle all of the associated CheckBox events, but I can't find anything to tell me which one has been clicked when the method is called at run time.

There is a parameter property but I am not sure if or how I can use it in this scenario. Am I missing something obvious here? Thanks in advance for any ideas and/or suggestions!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
I think what you want to look at is Application.Caller.
Code:
Private Sub CheckBox_Click()
     Msgbox Application.Caller
End Sub
 

sbendbuckeye

Active Member
Joined
Nov 26, 2003
Messages
440
Thanks Norie, that is exactly what I was looking for! I don't do Excel on a daily basis so I forget some of these types of things over time. I was pretty sure it was something in the Application object but couldn't find it.
 

Forum statistics

Threads
1,136,269
Messages
5,674,743
Members
419,525
Latest member
helensesc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top