View Single Post
  #7   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

"Gary Keramidas" <GKeramidasATmsn.com wrote in
on Thu 02 Aug 2007 01:37:20p:

this is untested and i'm not sure if it's even what you want.

once the combobox is populated, this would run and create an array of
the length of each entry:

For z = 0 To ComboBox1.ListCount - 1
arr(z) = Len(ComboBox1.List(z))
Next

then:
Application.Max(arr)

would return the element with the length of the longest entry
maybe you can use that to set the width, not sure what you want.



I don't know about the Application.Max(arr), but would I be able to do a
ComboBox1.ListWidth = arr ?