Query Table problem

R

Ron

Hi guys,

I have 2 query tables in one worksheet, in fact there's only 2 tables in
the whole workbook.

Here,s the code I use to refresh the table values..


Sheets("WEB QUERY").QueryTables(1).Connection =
"URL;http://lite.betfair.com/lite_view_market.asp?id=" & Range("y4")
Sheets("WEB QUERY").QueryTables(1).Refresh
Sheets("WEB QUERY").QueryTables(2).Connection =
"URL;http://lite.betfair.com/lite_view_market.asp?id=" & Range("y5")
Sheets("WEB QUERY").QueryTables(2).Refresh

The values in cells Y4 & Y5 are event numbers from the website data tables.

The problem being is that each day I keep having to swap the two ("y4") and
("y5") values around in this code.

Seemingly on a morning table (1) becomes table(2) and vice versa each
morning.

The cell values in Y4 & Y5 change throught the day, and they work perfectly
with the code that changes them.

It only happens once a day on the first refresh, after that they are fine.

I've tried naming the tables and substituting QueryTables(1) for
QueryTables(nameOne) etc but this didn't solve it, or I had the syntax
wrong.

Any help on this would be much appreciated.

Thanks,

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top