name of checkbox that was clicked in a userform

B

borg

Hi,

I have a userform with a bunch of checkboxes. I would like to identify the
name of the checkbox that was clicked. Is there an equivalent statement to
the one that allows me to get the name of the shape that was clicked?

I think this works for the shapes:
msgbox activesheet.shapes(application.caller).name

I've tried:
msgbox userform1.controls(application.caller).name


Thanks you.
 
D

Dave Peterson

I would think you'd use the _click event for that checkbox.

But this kind of thing worked ok for me:

Option Explicit
Private Sub CommandButton1_Click()
MsgBox Me.ActiveControl.Name
End Sub
Private Sub UserForm_Initialize()
Me.CommandButton1.TakeFocusOnClick = False
End Sub

This actually just shows the name of the control that has focus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top