View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default name of checkbox that was clicked in a userform

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.

borg wrote:

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.


--

Dave Peterson