I'm writing a macro, which can download weather data from the internet. I need to be able to veriable number of days which are downloaded, and the weather station.
The macro below will work fine if I choose to download few days, but if I want to download, for example a year, the macro will stop and "not responding" will appear.
I cant find a pattern for when the "Not Responding" message will appear, sometimes I can download months and other times, I can't download few weeks.
Do Until Range("B15") = Range("B18")
Range("N7").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "x"
ActiveCell.Offset(0, -3).Select
Selection.Copy
Range("C10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("N7").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -2).Select
Selection.Copy
Range("D10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("N7").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, -1).Select
Selection.Copy
Range("E10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim Airport_StationID As Range
Set Airport_StationID = Range("A10")
Dim Airport_date_day As Range
Set Airport_date_day = Range("C10")
Dim Airport_date_month As Range
Set Airport_date_month = Range("D10")
Dim Airport_date_year As Range
Set Airport_date_year = Range("E10")
AIR_URL10 = "URL;http://www.wunderground.com/history/airport/"
AIR_URL11 = Airport_StationID
AIR_URL12 = "/"
AIR_URL13 = Airport_date_year
AIR_URL14 = "/"
AIR_URL15 = Airport_date_month
AIR_URL16 = "/"
AIR_URL17 = Airport_date_day
AIR_URL18 = "/"
AIR_URL19 = "DailyHistory.html?format=1"
Dim AIR_URL_0 As String
AIR_URL_0 = AIR_URL10 & AIR_URL11 & AIR_URL12 & AIR_URL13 & AIR_URL14 & AIR_URL15 & AIR_URL16 & AIR_URL17 & AIR_URL18 & AIR_URL19
Range("A40").Select
ActiveCell.FormulaR1C1 = AIR_URL_0
With ActiveSheet.QueryTables.Add(Connection:= _
AIR_URL_0 _
, Destination:=Range("Q23"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Loop