Hi all,
The code below opens an Excel file and it fills a Combobox with values from a column. To do that I use a for-to-next function with an index "i".
I need the program to return the corresponding value of the index, for the item which will be selected in the combobox, in order to use it for lookups in the Excel.
Thanks
Dim i As Integer
Private Sub Form_Load()
Dim xlApp As New Excel.Application
Set xlWB1 = Excel.Application
xlApp.Visible = True
xlApp.Workbooks.Open "c:\book1.xls", , , True
For i = 1 To 10
Combo1.AddItem Cells(i, 1)
Next
End Sub
The code below opens an Excel file and it fills a Combobox with values from a column. To do that I use a for-to-next function with an index "i".
I need the program to return the corresponding value of the index, for the item which will be selected in the combobox, in order to use it for lookups in the Excel.
Thanks
Dim i As Integer
Private Sub Form_Load()
Dim xlApp As New Excel.Application
Set xlWB1 = Excel.Application
xlApp.Visible = True
xlApp.Workbooks.Open "c:\book1.xls", , , True
For i = 1 To 10
Combo1.AddItem Cells(i, 1)
Next
End Sub