I have some VBA that connects to the internet to download a table.
The code:
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q/hl?s=" & Range("S3").Value & "+Holdings", Destination:=Range( _
"$AD$1"))
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "11,13"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
It's in a loop that ends up creating 1000+ new named ranges, all the same. I'm pretty sure it's this part:
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://finance.yahoo.com/q/hl?s=" & Range("S3").Value & "+Holdings", Destination:=Range( _
"$AD$1"))
But I don't know if I should stop it, or just delete it after.
Bookmarks