LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Multicolumn Combo Box

I am trying to create code that will populate a combo box from an external
file. I am stumped why I am receiving an out of script error and basically
why my code isnt working. Could someone please tell me what I am doing
wrong?

Private Sub CommandButton1_Click()
Dim rowInx, numRows As Long
Dim MyArray() As String


'Set ComboxBox properties **
ComboBox1.BoundColumn = 1
ComboBox1.ColumnCount = 3
ComboBox1.ColumnWidths = "50 pt" & ";" & "200pt" & ";" & "50pt"
ComboBox1.ColumnHeads = True
ComboBox1.ListWidth = 325
ComboBox1.LinkedCell = "A6"

'this worksheet is 20 columns wide and at least 25 rows and is updated daily
**
'only the first 3 columns is needed to be displayed in the combobox **
Workbooks.Open Filename:="c:\CCF\Contracts1.xls"
With ThisWorkbook.Worksheets("Sheet1")

'Determine number of rows **
numRows = Application.CountA(ActiveSheet.Range("A:A"))

'Clear Listindexes **
ComboBox1.Clear

'Refresh listindexes with current data **
'the combobox should display 3 columns to the user **
'the combobox is embedded on a worksheet, not a userform **

For rowInx = 1 To numRows

MyArray(rowInx, 0) = ActiveSheet.Cells(1, (rowInx + 1)).Value
MyArray(rowInx, 1) = ActiveSheet.Cells(1, (rowInx + 1)).Value
MyArray(rowInx, 2) = ActiveSheet.Cells(1, (rowInx + 1)).Value


Next rowInx

'Load data into combobox ***
ComboBox1.Column() = MyArray
ComboBox1.ListIndex = 0
End With
ActiveWorkbook.Close

End Sub


 
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
multicolumn adress file. want to sort on last , first name bdcochran New Users to Excel 5 May 29th 09 06:47 PM
Transferring items between multicolumn listboxes [email protected] Excel Discussion (Misc queries) 2 September 28th 07 03:09 PM
Populating multicolumn listbox the wrong way notsureofthatinfo Excel Programming 0 October 22nd 03 11:38 PM
multicolumn Listbox and textalignment John Holland Excel Programming 3 September 11th 03 01:45 AM
Values in a MultiColumn Listbox Tom Ogilvy Excel Programming 5 September 5th 03 08:30 PM


All times are GMT +1. The time now is 10:57 PM.

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

About Us

"It's about Microsoft Excel"