Hi,
Can someone please help me? Thank you for your time and help in advance.
I have a combobox in VBA that belongs to workbook1, and I want the combobox in workbook1 to list all the sheets of workbook2 (which is a closed workbook).
Here is the code I have so far:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Private Sub UserForm_Initialize()
Dim wb2 As Object
Set wb2 = GetObject("C:\workbook2.xls", Sheet)
With wb2
For i = 1 To sheets.Count
ComboBox1.AddItem sheets(i).Name
Next i
End With
End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I am not sure how to make the link between workbook2 sheets and combobox1 in workbook1. Once again thank you for your help.
DDTiff
Can someone please help me? Thank you for your time and help in advance.
I have a combobox in VBA that belongs to workbook1, and I want the combobox in workbook1 to list all the sheets of workbook2 (which is a closed workbook).
Here is the code I have so far:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Private Sub UserForm_Initialize()
Dim wb2 As Object
Set wb2 = GetObject("C:\workbook2.xls", Sheet)
With wb2
For i = 1 To sheets.Count
ComboBox1.AddItem sheets(i).Name
Next i
End With
End Sub
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
I am not sure how to make the link between workbook2 sheets and combobox1 in workbook1. Once again thank you for your help.
DDTiff