Hey guys,
I want to run a macro that fetches data from internet pages. The URLs for these pages are located in cells, and I want to be able to run the same macro for each of these cells. I posted the code itself right now - could anyone give me suggestions on how to modify this to run down a column of cells and retrieve data from all the URLs?
I appreciate it!
Sub import()
'
' import Macro
'
' Keyboard Shortcut: Ctrl+q
'
ActiveCell.FormulaR1C1 = "http://URLHERE.COM"
Range("H1").Select
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://URLHERE.COM", Destination:=Range("$A$1"))
.Name = "lastfewnumbersofurl"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "12,13"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
I want to run a macro that fetches data from internet pages. The URLs for these pages are located in cells, and I want to be able to run the same macro for each of these cells. I posted the code itself right now - could anyone give me suggestions on how to modify this to run down a column of cells and retrieve data from all the URLs?
I appreciate it!
Sub import()
'
' import Macro
'
' Keyboard Shortcut: Ctrl+q
'
ActiveCell.FormulaR1C1 = "http://URLHERE.COM"
Range("H1").Select
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://URLHERE.COM", Destination:=Range("$A$1"))
.Name = "lastfewnumbersofurl"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "12,13"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With