effort1584
New Member
- Joined
- Apr 6, 2010
- Messages
- 2
My workbook will have between 20 and 200 sheets (situation dependent) with querytables added to each sheet. With that quantity I am hoping to not have to make each sheet active to get a query added. However, my testing so far shows it works every time the current query is referring to the active sheet and fails if it is not.
I have tried a couple of ways of referring to the sheet where I need to add the query.
Sheets(3).querytables.add
Sheets("shtName").querytables.add
dim a worksheet and set it using both examples above
Of course activesheet.querytables.add always works.
I am using Excel 2010, however I tested in Excel 2003 with the same result.
Is there another way to refer to the sheet to avoid using activesheet?
I have tried a couple of ways of referring to the sheet where I need to add the query.
Sheets(3).querytables.add
Sheets("shtName").querytables.add
dim a worksheet and set it using both examples above
Of course activesheet.querytables.add always works.
I am using Excel 2010, however I tested in Excel 2003 with the same result.
Is there another way to refer to the sheet to avoid using activesheet?