VBA web scraping script running too quickly

czarna dziura

New Member
Joined
Jun 3, 2015
Messages
7
Hi all,

I've created a script (I can post upon request) which walks through a column of stock symbols, then using google finance, grabs the company name, sector, and industry for each symbol.
The problem I'm encountering is say I have the symbols AAPL, GOOGL, and MSFT, the output should look as follows:
SymbolNameSectorIndustry
AAPLApple incTechnologyComputer Hardware - NEC
GOOGLGoogle incTechnologySearch Engines
MSFTMicrosoft Corp.TechnologySoftware - NEC

<tbody>
</tbody>
And does if I step through the code manually. But if I run the script the output looks like the loop is getting ahead of itself like so:

SymbolNameSectorIndustry
AAPLApple incTechnologyComputer Hardware - NEC
GOOGLApple incTechnologyComputer Hardware - NEC
MSFTMicrosoft Corp.TechnologySoftware - NEC

<tbody>
</tbody>
Basically one company symbol is being used for two rows (sometimes rows are skipped, or partially done), and the only thing I can think of to fix it is to force the script to pause every loop for 10 seconds for everything to catch up. Does anybody have a more elegant solution?

A follow up question to this, is that it will be applied to data pulled using power pivot, and I'd like to have it run on the symbols while still in the power pivot table instead of being exported and pulled back into power pivot. Is this possible with user made macros?

Thanks!
 
Last edited:

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,632
Messages
6,120,652
Members
448,975
Latest member
sweeberry

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
Back
Top