Management of formats in a listbox

Solved
denisw95 Posted messages 53 Status Member -  
Ant049 Posted messages 157 Status Member -
Hello,

I created a form with a ListBox that I populate with the following VB code:

 
J = 0
X = 0

For I = ligne_deb To ligne_fin
List_Catalogue(X, J) = Range(LettreColonne_deb & I).Value
List_Catalogue(X, J + 1) = Range(LettreColonne_deb1 & I).Value
List_Catalogue(X, J + 2) = Range(LettreColonne_deb2 & I).Value
List_Catalogue(X, J + 3) = CCur(Range(LettreColonne_deb3 & I).Value)
X = X + 1
Next I

Me.ListBox1.List = List_Catalogue


When my form is displayed, column 4 is shown in text format instead of Currency.

How can I adjust the format of a column in a listbox?

Thank you in advance for your help

Denis
Configuration: Windows / Chrome 46.0.2486.0

1 answer

  1. Ant049 Posted messages 157 Status Member 22
     
    Hello,

    It is not possible to "adapt the format of a column in a listbox".
    I advise you to change the format of your data before adding it to your listbox and then add it.
    0
    1. denisw95 Posted messages 53 Status Member
       
      Thank you for your feedback

      But that's what I'm doing when I integrate it into my table before integrating it into my ListBox
      0
    2. Ant049 Posted messages 157 Status Member 22
       
      Try to change your format with a code like this:

      List_Catalogue(X, J + 3) = Range(LetterColumn_deb3 & I).NumberFormat = "#,##0.00 $"
      0
      1. denisw95 Posted messages 53 Status Member > Ant049 Posted messages 157 Status Member
         
        Thank you for your help

        The exact command that works


        List_Catalogue(X, J + 3) = Format(Range(ColumnLetter_deb3 & I).Value, "#,##0.00 €")
        0
    3. Ant049 Posted messages 157 Status Member 22
       
      You're welcome, thank you for marking the topic as resolved.
      0