ComboBox number format

  • Hello

    I have a ComboBox in a UserForm that gets its values from a range in a work sheet via UserForm_Initialize.

    On the worksheet, the values are fomatted as "0000000" to get a leading zero, but the formatting is lost between the worksheet and the ComboBox ie 0681212 becomes 681212 in the ComboBox.

    Formatting the worksheet range as text works, but to save the user having to enter 500 numbers each time a new set is required, the 500 numbers are created based on the first number and then a simple +1 formula is used to create the remaining numbers.

    If the range is formatted to text the +1 formula doesn't work.

    How do I ensure the format is the same in the combobox as the range on the worksheet?

    Thanks in advance.

  • Re: ComboBox number format

    Thanks mrmmickle1

    I was populating the Combobox via

    Acquisitioncbo.List = Sheet7.Range("k1:k500").Value

    from the UserForm_Initialize

    When I changed to using RowSource it picked up the formatting.

  • Re: ComboBox number format

    FYI, a simple formula like:
    will increment as copied down and still return a text result.

    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!