mohanyathish
New Member
- Joined
- Apr 21, 2011
- Messages
- 48
i am using web queries to import data from web pages...
for example
www.quantcast.com/google.com/traffic
www.qauntcast.com/cnet.com/traffic
if u notice from the above examples, that only the name of the site in the url is changing
i am doing it for evry site manually...
is there any way wherein i can just run a macro for a list of sites, and the values wil get extracted into the excel..?
the site list will be something like this...
google.com
cnet.com
pcmag.com
etc.
Sub test()
Dim ipstring As String
Application.DisplayAlerts = False
ipstring = "http://quantcast.com/google.com/traffic"
With ActiveSheet.QueryTables.Add(Connection:="URL;" _
& ipstring, Destination:=Range("a1"))
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub
i have been able to get so far right now...
for google.com.....i just need these values.....
<table border="0" cellpadding="0" cellspacing="0" width="326"><col style="width: 157pt;" width="209"> <col style="width: 88pt;" width="117"> <tbody><tr style="height: 15.75pt;" height="21"> <td class="xl67" style="height: 15.75pt; width: 157pt;" height="21" width="209">Data</td> <td class="xl64" style="width: 88pt;" width="117">US</td> </tr> <tr style="height: 15.75pt;" height="21"> <td class="xl68" style="height: 15.75pt; width: 157pt;" height="21" width="209">Visits per Month</td> <td class="xl65" style="width: 88pt;" width="117">4,665,036,939</td> </tr> <tr style="height: 15.75pt;" height="21"> <td class="xl69" style="height: 15.75pt; width: 157pt;" height="21" width="209">People per Month</td> <td class="xl66" style="width: 88pt;" width="117">151,582,624</td> </tr> </tbody></table>
same table for other wesites as well
i dont know how to change the url to extract the values
kindly help...
for example
www.quantcast.com/google.com/traffic
www.qauntcast.com/cnet.com/traffic
if u notice from the above examples, that only the name of the site in the url is changing
i am doing it for evry site manually...
is there any way wherein i can just run a macro for a list of sites, and the values wil get extracted into the excel..?
the site list will be something like this...
google.com
cnet.com
pcmag.com
etc.
Sub test()
Dim ipstring As String
Application.DisplayAlerts = False
ipstring = "http://quantcast.com/google.com/traffic"
With ActiveSheet.QueryTables.Add(Connection:="URL;" _
& ipstring, Destination:=Range("a1"))
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.Refresh BackgroundQuery:=False
.SaveData = True
End With
End Sub
i have been able to get so far right now...
for google.com.....i just need these values.....
<table border="0" cellpadding="0" cellspacing="0" width="326"><col style="width: 157pt;" width="209"> <col style="width: 88pt;" width="117"> <tbody><tr style="height: 15.75pt;" height="21"> <td class="xl67" style="height: 15.75pt; width: 157pt;" height="21" width="209">Data</td> <td class="xl64" style="width: 88pt;" width="117">US</td> </tr> <tr style="height: 15.75pt;" height="21"> <td class="xl68" style="height: 15.75pt; width: 157pt;" height="21" width="209">Visits per Month</td> <td class="xl65" style="width: 88pt;" width="117">4,665,036,939</td> </tr> <tr style="height: 15.75pt;" height="21"> <td class="xl69" style="height: 15.75pt; width: 157pt;" height="21" width="209">People per Month</td> <td class="xl66" style="width: 88pt;" width="117">151,582,624</td> </tr> </tbody></table>
same table for other wesites as well
i dont know how to change the url to extract the values
kindly help...
Last edited: