Hi to all
I want to fill a combobox with the names of a close workbook
I try
but i receive
run-time error 9
Subscript out of range
Any help???
I want to fill a combobox with the names of a close workbook
I try
VBA Code:
Private Sub UserForm_Activate()
Dim i As Long
Dim ans As Long
ans = Workbooks(FileToOpen).Sheets.Count
ComboBox1.Clear
For i = 1 To ans
ComboBox1.AddItem Workbooks(FileToOpen).Sheets(i).Name
Next
End Sub
but i receive
run-time error 9
Subscript out of range
Any help???