View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
J.S.Winstrom J.S.Winstrom is offline
external usenet poster
 
Posts: 8
Default ComboBox listwidth to match text in list

?B?VG9tIE9naWx2eQ==?= wrote
in on Fri 03 Aug
2007 09:24:02a:

Here is what I mean Jim.

Private Sub UserForm_Initialize()
With Worksheets("Sheet1").Columns(6)
c = .ColumnWidth
.WrapText = False
.AutoFit
Me.ListBox1.ColumnWidths = .Width + 10
Me.ListBox1.Width = .Width + 20
Me.ListBox1.Font.Name = _
.Parent.Range("F10").Font.Name
Me.ListBox1.Font.Size = _
.Parent.Range("F10").Font.Size
.ColumnWidth = c
DoEvents
End With
End Sub

It worked perfectly for me. The OP would have to address restoring
wraptext to the Column IN THE WORKSHEET if that were a problem.

But I see you have led him on a merry dance, so hopefully he is happy.



For the most part, I'm headed in the right direction. I just need to
figure out how to load the array with the widths of the text entries and
the compare them to each other to find which one is the largest. Once I
can hack that data apart, I'll have what I need. But for the record, I
wasn't talking about a cell on a worksheet like you referenced in your
example. I was refering to a combobox list on a userform. So maybe that
line could be altered to say something to reference Combobox.Font.Size?

Anyways, thanks again guys for the help.

~J.S.Winstrom