Automatically updating MS Query Tool results in excel
Hello,
I am using Excel as front-end to an access database. Various cells in the spreadsheet are populated from an Access 97 database using the MS Query tool to build a count SQL Query. I can right-click on every cell and then choose "refresh" to update the result for each cell. However, since there are about 300 cells, to refresh them individually would be very time consuming. My question is this: is there a way in vba to "refresh" multiple cells from a single macro? I was thinking of a loop through each cell in a given range, with a command to refresh each query in turn. Does anyone know what this command would be? Many thanks |
Automatically updating MS Query Tool results in excel
Sub RefreshQueryTable()
Dim qt As QueryTable For Each qt In ActiveSheet.QueryTables qt.Refresh BackgroundQuery:=False Next qt End Sub "Sardonic" wrote: Hello, I am using Excel as front-end to an access database. Various cells in the spreadsheet are populated from an Access 97 database using the MS Query tool to build a count SQL Query. I can right-click on every cell and then choose "refresh" to update the result for each cell. However, since there are about 300 cells, to refresh them individually would be very time consuming. My question is this: is there a way in vba to "refresh" multiple cells from a single macro? I was thinking of a loop through each cell in a given range, with a command to refresh each query in turn. Does anyone know what this command would be? Many thanks |
All times are GMT +1. The time now is 12:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com