Copying and pasting data from multiple website into excel using VBA

AP_1903

New Member
Joined
Mar 9, 2015
Messages
1
I am new to VBA coding. I want some data from NSE-Company tracker websites. I tried using below code
Code:
[COLOR=#555555]Private Sub IE_Automation()[/COLOR]
<code style="margin: 0px; padding: 0px;">Dim R As Long
Dim IE As Object
Dim ieurl As String
Set IE = CreateObject("internetexplorer.application")

IE.Visible = True 'internet explorer run command
For *R = 2 To 10*
ieurl = "http://www.nseindia.com/companytracker/cmtracker.jsp?symbol=" & Sheets("Sheet1").Cells(*R*, 1)
IE.navigate ieurl 'internet url
Do
DoEvents
Loop While IE.Busy

IE.ExecWB 17, 2 'IE page selection command
IE.ExecWB 12, 0 'IE page copy command

Range("A2").Select
Sheets("Sheet2").PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:= _
        False 'IE page data paste command in excel

Next R
 </code>[COLOR=#555555]End Sub[/COLOR]

Please Use below Scrip code at Place of R: MANAPPURAM, PDSMFL, MINDACORP, CIGNITITEC, SHEMAROO, SUPERHOUSE, SHARDACROP, SNOWMAN, SBIN
While I am executing above code, VBA is pasting only data for first Scrip and sometimes it is showing debug error at copy paste code. If I am debugging macro manually(using F8 key) it is correctly executing the procedure. I have also used ReadyState Property to Webdata load but its not working.
I wanted to copy and paste the data for all scrip (one by one) into excel.
Please help me to scrap the data from the website into excel.
Document Link is here:
HTML:
http://www.mediafire.com/download/pzbov8m58jbtmxz/web+scraping.xlsm
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,216,759
Messages
6,132,558
Members
449,735
Latest member
Gary_M

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