For work I need to pull order information off a website. I've created an Excel file with a list of order numbers on one sheet (row J) and would like to populate the information from each order onto a separate sheet. I've created a web query with parameters to pull the order I select, then create a new worksheet. When I run the macro, the parameter box pops up, I click on the next order # from my list, the query runs and creates my next worksheet.
My current code is below. I'm trying to automate the process to prevent me from manually clicking the next order #, allowing the macro to pull the first order # from cell J2, adding it to my web query url, place the web query results in sheet 1 cell A1, pull the second order # from cell J3, place the results in sheet 2 cell A1, and so on until it reaches the end of the order #s. Any help would be greatly appreciated.
Sub MyFileWebQuery()
'
' MyFileWebQuery Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;C:\Users\reason\Desktop\Web Queries\MyFile.iqy", _
Destination:=Range("$A$1"))
.Name = "MyFile"
.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
Sheets.Add After:=Sheets(Sheets.Count)
End Sub
My current code is below. I'm trying to automate the process to prevent me from manually clicking the next order #, allowing the macro to pull the first order # from cell J2, adding it to my web query url, place the web query results in sheet 1 cell A1, pull the second order # from cell J3, place the results in sheet 2 cell A1, and so on until it reaches the end of the order #s. Any help would be greatly appreciated.
Sub MyFileWebQuery()
'
' MyFileWebQuery Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;C:\Users\reason\Desktop\Web Queries\MyFile.iqy", _
Destination:=Range("$A$1"))
.Name = "MyFile"
.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
Sheets.Add After:=Sheets(Sheets.Count)
End Sub