enumerate queries in sheets of an excel workbook
I need a vba macro to enumerate the开发者_StackOverflow queries on each worksheet of a workbook.
Can you provide example code?
Jerry E
Here you go:
Dim aSheet As Worksheet
For Each aSheet In Worksheets
Dim aQueryTable As QueryTable
For Each aQueryTable In aSheet.QueryTables
' Do something with aQueryTable, e.g.
MsgBox aQueryTable.Name
Next aQueryTable
Next aSheet
精彩评论