ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Web Query/Cell Reference (https://www.excelbanter.com/excel-programming/295561-web-query-cell-reference.html)

hawkeyes2002[_4_]

Web Query/Cell Reference
 
I've got a spreadsheet that contains a number of different web querie
for MLB stats from espn.com. I'm trying to create a macro that wil
refresh the data for these queries. Here's a visual of what it look
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
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 cell
below 'TEAM NAME' " part. Any help would be appreciated

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


Dick Kusleika[_3_]

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/





All times are GMT +1. The time now is 01:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com