1) Identify the range of cells your web query is updating. In my macro it is looking at cells A1:A10. You need to replace that with your actual range to watch. Then you need to pick matching "ranges" in two other places to serve as "on deck" area and the "prior data" areas. The macro is using AA1:AA10 as ondeck, and AB1:AB10 as prior data ranges. Change those to match your actual range.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Application.EnableEvents = False
Range("AA1:AA10").Copy Range("BA1:BA10") 'On Deck becomes Prior Data
Range("A1:A10").Copy Range("AA1:AA10") 'New data copied to On Deck area
Application.EnableEvents = True
End If
End Sub
After you've edited the macro for your working environment (the colored ranges I've already explained), then here's how to install the macro into your sheet:
A. Right-click on the sheet tab name and select View Code
B. The VB Editor will open, paste in the edited code
C. Get out of VBA (Press Alt+Q)
D. Save your sheet
The macro is installed and live. The next time the web query updates the red section, the copying will occur.
2) Once that is working properly, highlight the "ondeck" area and the "Prior Data" area and activate the Chart Wizard, use it to help you create your bar graph.
Bookmarks