New to vba, trying an 'on error goto' but, I keep getting errors 'index out of range'.
I just want to make a combo box that is populated by the names of worksheets which contain a querytable.
For Each oSheet In ActiveWorkbook.Sheets
On Error GoTo NextSheet:
Set qry = oSheet.ListObjects(1).QueryTable
oCmbBox.AddItem oSheet.Name
NextSheet:
Next oSheet
I'm not sure whether the problem is related to nesting the On Error GoTo inside a loop, or how to avoid using the loop.
What about?
Or
Actualy the Gabin Smith's answer needs to be changed a bit to work, because you can't resume with without an error.
I that can help you, I have the following function in my "library". Since it's a mix of functions I wrote and functions I found on the net, I am not very sure where that one comes from.