View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Web Query/Cell Reference

hawkeyes2002

How many web queries do you have on your sheet? Two? Do you want to find a
specific team name and only update the stats for that team? Do you want to
update all the web queries on the sheet? Do the locations of TEAM NAME
change because the web queries are expanding and contracting?

Here's a couple of ideas. If you answer the above questions, I can give you
more specific help.

To update a query
Sheet1.QueryTables(1).Refresh

To update all queries
ThisWorkbook.RefreshAll

If TEAM NAME moves, I would create range names (Insert-Name-Define) for the
team name cells. Then you can find their queries like
Range("Team1").Offset(2,0).QueryTable.Refresh

where Team1 is the a named range.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"hawkeyes2002 " wrote in
message ...
I've got a spreadsheet that contains a number of different web queries
for MLB stats from espn.com. I'm trying to create a macro that will
refresh the data for these queries. Here's a visual of what it looks
like:

TEAM NAME

stats from web query
stats from web query
stats from web query


TEAM NAME

stats from web query
stats from web query
stats from web query

The data from the web queries do not always stay the same size. What I
want the macro to do is this:

find "TEAM NAME", select the cell that is two cells below "TEAM NAME",
and refresh the data from the web query.

I'm having trouble figuring out the "select the cell that is two cells
below 'TEAM NAME' " part. Any help would be appreciated.


---
Message posted from http://www.ExcelForum.com/