dynamic table from a web query?

brandco

New Member
Joined
May 27, 2010
Messages
2
I'm trying to create an excel worksheet that takes information from a web query and adds it to a table each month when the content of the web query changes.

There is a table on a web page that contains some economic data. It changes every month. I have made a table that checks to see if the information is new (not the same as the row above) and if it is new adds the new numbers to the table with vlookup, otherwise it prints "" in each cell.

I've looked and looked, but I can't find a way to have the table save the information automatically before the contents of the table change. Say the first line is "July-10", which matches the web query today. Next month the query will change and the first line of the table will change to "Aug-10". I want to keep last month's data and add a new line whenever the web query changes.

One solution I thought of is to change the contents of the cells to their values with the F9 key every month. However, I want to make similar worksheets with many different queries that change on different days - making manually changing the cells to their values cumbersome. (What if I wanted to get the open, close, high and low prices from 10 stocks every day and add it to a table?)

Is there a better way?

FYI I don't know VBA.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,823
Two ways using VBA are:

1. Use the Worksheet_Change event on the web query sheet to copy the web data to other cells or to another sheet.

2. Use the BeforeRefresh and/or AfterRefresh query events to copy the web data. http://support.microsoft.com/kb/213187 shows how to set up the event handlers.

If you create your web query with the Macro Recorder and post the code generated (Alt-F11 to open the VB Editor) I can help with the above.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,133,379
Messages
5,658,472
Members
418,446
Latest member
JValencia

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top