OK. Now we're on our way!
On your FIRST query, SELECT ALL the DATA & HEADINGS then
Formulas > Defined Names > Create from selection -- Create names from values in the TOP row.
Copy this code and PASTE in the same module, OVER your original recorded code.
Code:
Sub Main()
Dim r As Range
For Each r In [[highlight]????????[/highlight]]
queryedit r.Value
Next
End Sub
Sub queryedit(URL As String)
'
' "URL;[URL unfurl="true"]http://www.longassweblink.com/otherstuff/thensome.html"[/URL]
'
With ActiveSheet.QueryTables(1)
.Connection = "URL;" & URL
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = True
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Go to the Name Box and SELECT & COPY the NAME that corresponds to column A, and Replace [highlight]????????[/highlight] in the code, with that Name.
ALSO, check the values in column A, as having the form...
[tt]
http://something
[/tt]
http:// is essential. It that is NOT in each value in column a, then it must be inserted in the code as...
Code:
.Connection = "URL;[URL unfurl="true"]http://"[/URL] & URL
Now you are ready to run a TEST.
ACTIVATE the sheet that has the SECOND web query.
STEP into the MAIN() procedure (F8) and then STEP OVER (SHIFT + F8) thru several URL values and OBSERVE that the corresponding query is executed and returns the data from that page. You are not doing anything with the returned data yet -- just checking that the data from each web page is returned.
The next step is to decide 1) WHAT data you want for each web page and 2) HOW to get that data from that sheet back to the original sheet.
In the code, I would change [highlight]ActiveSheet[/highlight] to a specific sheet name, using [highlight]Sheets("SomeSheetName")[/highlight]
Skip,
Just traded in my old subtlety...
for a NUANCE!![[tongue] [tongue] [tongue]](/data/assets/smilies/tongue.gif)