Is this possible? To run a web query & add additional information using VBA

joffy1979

New Member
Joined
Apr 26, 2013
Messages
5
I have the following:

Sub Web_Query()
Dim wsWQ As Worksheet
Dim rCell As Range

Set wsWQ = Sheet1

For Each rCell In Sheet2.Range("C2", Sheet2.Cells(Sheet2.Rows.Count, "C").End(xlUp))
With wsWQ.QueryTables.Add(Connection:= _
"URL;http://hitchin.play-cricket.com/scoreboard/individualPerformanceResults.asp?seasonID=26&userID=" & rCell & "&ruleTypeID=6101", _
Destination:=wsWQ.Cells(wsWQ.Rows.Count, "A").End(xlUp)(2, 1))
.Name = "ID_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = True
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertEntireRows
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next rCell
End Sub

As you can see I reference C2 from sheet2, i would like to add a name found in the correspondinghttps://www.google.co.uk/search?cli...a=X&ei=0DOdUab_GuaN0AXWhIH4AQ&ved=0CCwQvwUoAA cell in coloumn B to column O (A to N are taken from the result of the query) in sheet1 (which holds the result of the above macro). So i would like the above Sub to run the web query from a list of URLs, and for the corresponding name to be added with the results of the above query in column O.

Any help would be great
smile.gif
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,216,022
Messages
6,128,325
Members
449,440
Latest member
Gillian McGovern

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