PDA

View Full Version : Macro to loop through Web Queries and enact a second macro once each page loads



RINCONPAUL
05-04-2016, 11:23 PM
In the attachment, sheet 'Races' has a table of Venue&Race No.'s in col D. In cols E & F is a manually entered list of Web Query parameters for a separate web page per row. There can be quite a few! At the top in cell D2 is a dropdown, whereby I manually select a race , the vlookups in cells E2 & F2 look up the parameters. As each race is selected the web query refreshes and loads a new page that appears on Sheet5. There is a 'button' here that I press (I use a split screen view) and the macro 'Getslections', (a Leith special) produces the selections in Sheet5 col B.

This is extremely time consuming, as a page takes about 5-6 secs to load. What would be good , would be a macro button located on sheet 'Races', that loops through each race D8, D9, D10...., the page loads, the 'GetSlections' macro fires and the selections get posted horizontally in sheet 'Races' col's $H8:$?8 adjacent to each race. basically where the web addresses are now (not needed). These selections are then transferred manually copied and pasted to an excel bot.

Thanks for your interest.

RINCONPAUL
05-05-2016, 02:34 PM
OK, that was a doozie of an assignment, so I'll reduce my expectations a little. I would like a macro, fired by a button on Sheet1, that finds a match in cells D8, D9, D10... to $D$2. If found, copy and paste cell range $H$2:$L$2 adjacent to found row (in this instance range(H11:L11)). Cell $D$2 is everchanging, so the button will be pressed each time to run the macro, to populate the H:L columns.
Cheers