espenskeie
Well-known Member
- Joined
- Mar 30, 2009
- Messages
- 636
- Office Version
- 2016
- Platform
- Windows
Hello
I have a userform with a multicolumn listbox that keeps 8 columns. In 2010 excel I get everything nice and perfect, but when I run the code in 2003 my columns are all messed up. I thought that this code would do the job, but obviuos it wont:
This is the only thing missing before I can finish the project...
Kind regards
Espen
I have a userform with a multicolumn listbox that keeps 8 columns. In 2010 excel I get everything nice and perfect, but when I run the code in 2003 my columns are all messed up. I thought that this code would do the job, but obviuos it wont:
Code:
Dim rng As Range
Dim iX As Integer, iY As Integer
Dim CW As String
With Sheets("1HourDATA")
'get the range for the RowSource
For iX = 1 To 4
Set rng = Choose(iX, .Range("LongList"), .Range("ShortList"), .Range("TickList"), .Range("Ticklist"))
With Me("ListBox" & iX + 2)
.ColumnCount = rng.Columns.count
.RowSource = rng.Address(external:=True)
CW = ""
'match ColumnWidths to RowSouce Columns
For iY = 1 To .ColumnCount
CW = CW & rng.Columns(iY).Width & ";"
Next iY
.ColumnWidths = CW
.ListIndex = 0
End With
Next iX
End With
This is the only thing missing before I can finish the project...
Kind regards
Espen