none
Userform Listbox word wrap RRS feed

  • Question

  • Evening all

    I have a Userform which i use to generate a quiz from a question bank. Once the quiz has been generated i have it display in a ListBox in 4 columns on the Userform. Unfortunately some of the questions are too long for each columnwidth. is there a way I can wordwrap each row of text to fit in the columnwidth. the current code i am using to display the data is

    Dim dlr as Long
    
    dlr = wsQuiz.Cells(Rows.count,1).End(xlUp).Row
    
    ListBox1.ColumnCount = 4
    
         ListBox1.List = Sheets("Quiz").Range("A3:D" & dlr).value

    Thanks

    Steve

    Monday, March 4, 2019 6:32 PM

All replies

  • No, list boxes don't wrap text...

    Either increase the column widths, or use text boxes instead of a list box.


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Monday, March 4, 2019 8:35 PM
  • Thanks Hans

    How would the code go if i used a textbox?

    Steve

    Tuesday, March 5, 2019 5:44 AM
  • You could create as many text boxes as you have questions, and place each question in its own text box.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Wednesday, March 6, 2019 4:37 PM
  • Hans

    Sadly the number of questions is set by the Examiner. I have however been able to generate the code to do this, but not add the questions to each box. I am looking to use the these generated boxes to add the mark achieved for each question. I have asked another question relating to this Adding data to automatically added textboxes

    If I can work out how to add the question to the relevant generated box I may add another column of Boxes for the achieved mark.


    Steve

    Wednesday, March 6, 2019 5:54 PM