Populating a fmStyleDropDownList with number values from list

vbaNumpty

Board Regular
Joined
Apr 20, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
I have discovered a very odd interaction and I am hoping someone can explain to me why it is happening.

I have some code in a userform that populates comboboxes with values if you select a line of data from a list box and click on edit.

One combobox populates with strictly numbers, all the others are text based. No matter what I did, that one combobox in particular would not populate if I had the style as fmStyleDropDownList. It works fine if I change it to fmStyleDropDownCombo, but that opens the door to have user input error of data that isn't compatible which means more work coding a check to ensure the value is allowed.

On a hunch I tried going to the source of the list, and adding an ' in front of each number to convert them to text, and low and behold the combobox now populates fine with the fmStyleDropDownList style.

My question is why does it stop working and give a value error, or simply fail to populate the combobox if the data are numbers rather than text?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,223,886
Messages
6,175,194
Members
452,616
Latest member
intern444

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