Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Workbook and Fill Combobox Quest?

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
I am trying to fill a combobox from a closed workbook without the user noticing. The following is my code and I'm not sure how to hold on to the data once I close the WB. Any help would be OneDERFULLLLLL.

Private Sub UserForm_Initialize()
Dim ListItems As Range, SourceWB As Workbook
With Me.ComboBox1
.Clear
Application.ScreenUpdating = False
Set SourceWB = Workbooks.Open("H:\WIP2\Teams.xls", False, True)
lastrow = Rows.Cells(65536, 1).End(xlUp).Row
Set ListItems = SourceWB.Worksheets(1).Range("A1:A" & lastrow)
.RowSource = ListItems
End With
Application.ScreenUpdating = True
Set SourceWB = Nothing
SourceWB.Close False
End Sub

For just $19.95 you too can have a beautiful smile.
 
Hi,

You could copy first the data into a hidden sheet and then populate, from it, your combo.


Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 

Or create a collection and add the items from SourceWB.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top