HWL
Active Member
- Joined
- Dec 1, 2009
- Messages
- 462
I'm trying to have a macro that creates a list box of the names of the open Excel files so the user can select, which will continue my code on the file selected.
I thought something like this would work but it isn't:
I thought something like this would work but it isn't:
Dim wbk As Workbook
For Each wbk In Workbooks
'loop through the Open workbooks
If wbk.Name <> ThisWorkbook.Name Then
'exclude this workbook from the Loop
else
ListBox1.additem wbk.name
next wbk
Endif
This fails as saying the Next needs a For even though there is a FOR.For Each wbk In Workbooks
'loop through the Open workbooks
If wbk.Name <> ThisWorkbook.Name Then
'exclude this workbook from the Loop
else
ListBox1.additem wbk.name
next wbk
Endif