jamescooper
Well-known Member
- Joined
- Sep 8, 2014
- Messages
- 834
Hello I have the following code that pulls the data from the URLs listed in cells A1:A84. How would I modify it please so that it ignores urls that do not have any content?
Many thanks.
Many thanks.
Code:
Sub Data()
Dim URL As Range
Dim nxRw As Long
Dim Addrw As Long
Sheets("Data").Select
For Each URL In Range("A1:A84")
nxRw = Range("C" & Rows.Count).End(xlUp).Row + Addrw * 2
With ActiveSheet.QueryTables.Add(Connection:="URL;" & URL.Value & "", _
Destination:=Range("C" & nxRw))
.Name = Right(URL.Value, 27)
.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
Addrw = 1
Next URL
End Sub