Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default name of checkbox that was clicked in a userform

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default name of checkbox that was clicked in a userform

Thank you for the quick response. It was exactly what I needed. Thanks again.



"Dave Peterson" wrote:

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

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
How to make a checkbox on a chart invisible when it is clicked? Naum Charts and Charting in Excel 2 December 20th 07 08:10 PM
Determine when checkbox is clicked wAyne Excel Discussion (Misc queries) 1 February 21st 06 08:35 PM
CheckBox in userform MD Excel Programming 2 December 2nd 04 06:42 PM
CheckBox on UserForm Michel[_4_] Excel Programming 0 August 3rd 04 12:38 AM
Userform and checkbox.... Ben.c Excel Programming 3 December 19th 03 05:56 PM


All times are GMT +1. The time now is 10:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"