So I'm getting a Run-Time Error 1004 when I run the code below. Basically it looks for a URL on a separate sheet (Sheet 1) in cell (BA2) and is supposed to scrape the data from the URL in cell BA2 and dump it into Sheet 1's cell of C1. When I run this code I am on Sheet 4. The code drops the 1004 error and when I debug it highlights the ".Refresh BackgroundQuery:=False" line of the code. Not sure why this isn't working, basically looking for another set (or 1000) of eyes. It works fine when I am the Active sheet is Sheet 1 but not when the Active Sheet is Sheet 4. It is driving me nuts.
Code:
Sub PullInfo()
With Sheets("Sheet1").QueryTables.Add(Connection:="URL;" & Range("$BA$2"), Destination:=Sheets("Sheet1").Range("$C$1"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingAll
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub