excel 2007 combo box

M

marooned

Processor: Intel

I am an excel newbee. I can insert a combo box in excel 2007 and populate it. I have a column "description" and a list of items in the combo list. I have 2 problems. 1. When I click the item only a number is entered in the cell. 2. I want to be able to insert the item in any cell that gets focus.Kindly guide me.
 
L

Laroche J

Processor: Intel

I am an excel newbee. I can insert a combo box in excel 2007 and populate it.
I have a column "description" and a list of items in the combo list. I have 2
problems. 1. When I click the item only a number is entered in the cell. 2. I
want to be able to insert the item in any cell that gets focus.Kindly guide
me.

1. Yes, the number is the rank of the item in the combo box. Use that number
as an argument to an INDEX formula to get the value (description) you want.
This is useful because you may want to show something in the combo box but
obtain different values as results.

2. Excel cannot "send" a value to a cell. You need some VBA to do what you
want. Right-click on the combo box and chose Assign Macro. Click on New and
enter the following code in the empty Sub probably named DropDown1_Change():
Selection.Value = Range("myTable").Cells(Range("rank").Value,1)
myTable is a range where your data is stored, and rank is a single-cell
range that is the Combo Box's cell link. Use your own names for the ranges.
The 1 at the end means to use data from the first column of myTable; change
as you wish.


And to borrow from Bob Jones:
It would appear that you're using Excel on a Windows box but you've posted
to the group for Excel on the Mac. They're alike in many respects but there
are also a number of differences -- especially if you're using Excel 2007.
Start here for any future posts:

--
http://www.microsoft.com/office/community/en-us/FlyoutOverview.mspx


JL
Mac OS X 10.4.11
Office v.X 10.1.9, Office 2008 trial
 
M

marooned

Thanks for the quick response. Meanwhile I was able to solve the problem by the following code.

Private Sub ComboBox1_Click()
ActiveCell.Value = ComboBox1.Value
End Sub

This puts the combo value in text format in the target cell and now I am
Able to insert the item in any cell that gets focus.

Once again Thank you.
 

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