Selection from combobox is text not number!

DaddyWeg

New Member
Joined
Dec 25, 2003
Messages
18
Hello Everyone!

I have two selections in a combo box. Both are numbers. However, when I select either one and it enters that value in the linked cell, it is seen as text instead of a number. Is there a way to fix this so that every time a selection is made it is returned as a number?

:roll:
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Yo DaddyWeg

1) make sure the cell your putting your data in is formatted as number... or currency depending on whatever you need.

2) Values can be converted between text and values as required
For example...
combobox data to number... Range("MyValueRange") = val(combobox.value)

cell value changed to a string... Range("MyTextRange") = str("MyValueRange")
 
Upvote 0
Have same problem, but I am not using VBA, just the normal properties box. How do I change that to work with numbers

Charlie
 
Upvote 0
This is just the fix I need, but where exactly do I put the code...

Range("MyValueRange") = val(combobox.value)

I tried several different ways, but none of them worked.

Thanks for your help.
 
Upvote 0
Yo DaddyWeg

1) make sure the cell your putting your data in is formatted as number... or currency depending on whatever you need.

2) Values can be converted between text and values as required
For example...
combobox data to number... Range("MyValueRange") = val(combobox.value)

cell value changed to a string... Range("MyTextRange") = str("MyValueRange")




I have a list that has both numbers and text how do I have the combobox display both?
 
Upvote 0
A ComboBox only contains Strings, never numerical types.

A combobox might contain a numeral, but never a number (i.e. "12" not 12)

Similarly, ListBoxes, TextBoxes, Labels.
 
Upvote 0
I have a list that's linked to my combobox that has both text and numbers how do I have both output into the linked cell correctly?
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,822
Members
452,672
Latest member
missbanana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top