How to automate a web query

RichardK

New Member
Joined
Jan 28, 2015
Messages
4
Hi, i am new to the forum and my VB skills are limited to really what i can successfully do when i use a Macro Recorder. That said i am trying to automate a web query and import data into a spreadsheet.

I have a list of URL's in a spreadsheet - its weather data - and i want to import that data into an excel worksheet...advance about 300 rows and repeat that for all the URL's in the list [there are several hundred]

the problem is that the web query is not looking at the list so i literally import the same data over and over...thats the part i need help with. THis is what i have so far...please help

Sub attempt1()
'
' attempt1 Macro
'


'
Do Until IsEmpty(ActiveCell)
ActiveCell.Select


Selection.Copy
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"http://www.wunderground.com/history/airport/KASW/2014/8/31/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA&MR=1"

Sheets("Sheet1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.wunderground.com/history/airport/KASW/2014/8/31/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA&MR=1" _
, Destination:=ActiveCell)
.Name = "DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA&MR=1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
ActiveCell.Offset(300).Select
Sheets("Web page").Select
ActiveCell.Offset(1).Select

Loop

End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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