Name of combo box that is being changed

Foo_Man_Chu

Board Regular
Joined
Jul 22, 2010
Messages
79
how do I get the name of the combo box that the user has clicked on? I mean, to get the reference for a button I have used ActiveSheet.Buttons(Application.Caller), but is there something like that I can use so when the subroutine is called for the change event on the combo box I can know which box is being changed? I ask because I have several different combo boxes I would like to have the same sub run for and I don't necessarily know the name of the box when it is clicked. Thanks in advance.
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,767
Office Version
365
Platform
Windows
Application.Caller should work with comboboxes as well as command buttons.

You might not be able to refer to a collection called Buttons but you should at least get the name.

PS Application.Caller only works for controls created from the Forms toolbar, or is it the Control Toolbox. It's one or the other anyway.:)

PPS Why do you need/want the name of the combobox name anyway?
 

Foo_Man_Chu

Board Regular
Joined
Jul 22, 2010
Messages
79
What is the specific syntax of application caller that I should use to get the name of the combo box though? Example, say I wanted to display the name of the combo box that was clicked, what would I put in the msgbox tag?
MsgBox(Application.Caller?)

The reason I want to know is because I have a bunch of different combo boxes that get created on the fly and when a specific one is clicked I want to do something to the properties of just that one combo box, so I need to get the reference of the specific box that was changed.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,770
Forms menu controls of all kinds can be accessed with the Shapes collection.
 

Foo_Man_Chu

Board Regular
Joined
Jul 22, 2010
Messages
79

ADVERTISEMENT

Thanks for the answer, but I guess I need to specifically know the syntax for what I'm asking, which is what is the code to reference the combo box that was clicked? If it can be accessed with the Shapes collection, please explain what specific syntax will return the name of the combo box.

Thanks for the prompt replies everyone!
 

Foo_Man_Chu

Board Regular
Joined
Jul 22, 2010
Messages
79
Actually, upon looking into it more it appears that I'm actually looking to get the name of an ActiveX combo box, not a forms control.
 

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,471

ADVERTISEMENT

What version of excel are you using?
 

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,471
Actually you need to be in Design View to view the Active-X Controls name(s). Depending on the version you are running determines how you get to the design view.
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,770
If the control is an ActiveX control, then clicking on it triggers an event that is specific to that control.

Have you tried
Code:
MsgBox ActiveSheet.Shapes(Application.Caller).Name
I'm not as sure as I am about Forms controls, but I think it should work.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
75,767
Office Version
365
Platform
Windows
There is no specific syntax for Application.Caller and it takes no arguments.

It only works with controls from the Forms toolbar as far as I'm aware.

If you are working with ActiveX controls you'll need another approach.

What that is exactly depends on what you are actually trying to do.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,875
Messages
5,513,925
Members
408,978
Latest member
Ken0356

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top