PDA

View Full Version : [SOLVED] trying to pull dynamic webquery data



vanja123
01-08-2017, 03:21 PM
Hi all! I'm very new to vba, and struggling with a "compile error: sub or function not defined". Probably quite simple to figure out for you, but i've been stuck for hours!! Please help! Thanks!!



Sub multiplier()


Dim myurl As Variant
Dim i As Integer



For i = 1 To 183


myurl = Sheet("base").Range("A" & "i")
Sheets.Add After:=ActiveSheet


Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & myurl, Destination:= _
Range("$A$1"))
.CommandType = 0
.Name = "index.shtml"
.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

ActiveSheet.Name = Range("$A$49")
End With
Next i


End Sub

vanja123
01-08-2017, 03:29 PM
thanks i solved it myself! :)))