PDA

View Full Version : How to count nbr of QueryTables in workbook



dbmagnus
01-04-2011, 12:17 PM
I'm using Excel 2010 and trying to count the number of QueryTables in a workbook. Then I want to refresh them all, and have a cell that displays the text, "Refreshing Data Block X of Y" (where X is the one being refreshed and Y is the number of Datablocks in the workbook).

I've found code in my search for counting the number of datablocks in the activesheet, but not for an entire workbook. My workbook has 20+ worksheets, each with a datablock on it. What's the best way to count these?

Thanks!

Bob Phillips
01-04-2011, 02:19 PM
Just add another, outer loop going through all the worksheets.