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.
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,368
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:

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,356
Messages
5,510,822
Members
408,813
Latest member
ACAyeras

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top