?
Solved

Name of Combo box?

Posted on 2011-04-20
4
Medium Priority
?
246 Views
Last Modified: 2012-05-11
I have a sheet with 2 combo boxes (Form Control, not ActiveX).  I have found VBA code that will let me reset them to a specific entry. The code needs the names of the boxes.
 But how do I find the names of the boxes? Or how do I name them?  The Format Contol panel has no naming function.
0
Comment
Question by:IBMJunkman
  • 2
  • 2
4 Comments
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35433566
When a shape such as a Forms control is added to a worksheet, Excel gives it an arbitrary name such as "Picture 1". The numeric part of the name changes during the life of the worksheet - it is incremented with each new shape added regardless of which previously created shapes may have been deleted.

To name a shape, select the shape and type the name in the Name Box located in the extreme left side of the Formula bar. Press ENTER to accept the name.

Kevin
0
 

Author Comment

by:IBMJunkman
ID: 35434095
Well, I got them named.  But the code does not work.  I want the list to display with the 2nd entry showing.

Sheets("PaceMCPDT").Shapes("WS").Select
Selection.ListIndex = 2

Perhaps this code is not correct?
0
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 35434137
Sheets("PaceMCPDT").Shapes("WS").OLEFormat.Object.ListIndex = 2

Kevin
0
 

Author Closing Comment

by:IBMJunkman
ID: 35434193
Worked perfectly.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question