PDA

View Full Version : Solved: Userform displays ? for cell text that uses "Alt+Enter"



malik641
12-10-2005, 11:19 AM
In my list box I added cell text and some of the cells use the "Alt+Enter" method to right text. When I add these items to the userform, they show up as ?. How can I replace these with spaces??? Or is there a way to format the list box (like a wrap text...or something)??

I tried the following:
For Each cell In CriteriaRange
If InStr(1, cell.Text, Chr(182), vbTextCompare) Then
cell = Replace(cell.Text, Chr(182), " ")
End If
lstCriteria.AddItem cell
Next cell

But this doesn't seem to effect the display in the list box :mkay
Any ideas??

mdmackillop
12-10-2005, 11:46 AM
Hi Joseph
try

ListBox1.AddItem Replace([A1], Chr(10), " ")
or

Dim Txt
Txt = Split([A1], Chr(10))
For i = 0 To UBound(Txt)
ListBox1.AddItem Txt(i)
Next

malik641
12-10-2005, 12:00 PM
Sweet! Thanks Malcom :thumb


Solved!

mdmackillop
12-10-2005, 12:07 PM
Glad to help :friends:

malik641
12-10-2005, 12:21 PM
Glad to be helped! :friends:

Could you help me with the other post I made about Scripting.Dictionary (http://vbaexpress.com/forum/showthread.php?t=6381)...I'm having the same problem you had. I can't get the list boxes to take unique items :dunno

Thanks again Malcom!