Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default listbox integral 'width'?

Hello all,

Is it possible to 'textwrap' an entry in a listbox so that if the length of
text exceeds the width of a listbox, it wraps/continues in the row beneath?

Example: I have a spreadsheet where a listbox resides. With the list box
there is a commandbutton that will enter the text of a textbox into the
listbox via additem.

I have managed to make it work by using the mid and len worksheet functions
where if the text length exceeds the width of 42 characters (close to the
length of the listbox):
Dim txt1 As String
Dim txt2 As String
Dim txt3 As String

txt1 = "Plyr 1: " & TextBox1.Text
Worksheets("sheet2").Range("a21") = txt1
txt2 = Worksheets("sheet2").Range("h22").Text
txt3 = Worksheets("sheet2").Range("h23").Text

ListBox1.AddItem (txt1)
If txt2 < "" Then
ListBox1.AddItem (txt2)
End If
If txt3 < "" Then
ListBox1.AddItem (txt3)
End If

I picked the length of 42 because I typed in 1thru 60 to see how many would
fit. I know that not all characters are the same length, but this seems to
work for the most part.

I have to think there is a better way. Is there?

Thanks.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use an integral for cell output value. Corribus Excel Discussion (Misc queries) 4 December 16th 09 08:39 PM
definite integral dmahn14 Excel Worksheet Functions 0 April 14th 09 03:59 AM
How to do integral calculus in Excel spreadsheet? windtalker Excel Worksheet Functions 2 September 3rd 06 07:11 AM
Listbox Column Count and Width Dont work. Seems Easy Brandon Johnson Excel Programming 7 June 7th 06 06:07 PM
ListBox with variable width columns ? Kevin Beckham Excel Programming 0 December 4th 03 09:10 AM


All times are GMT +1. The time now is 01:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"