Loop Through Queries

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
656
Hi I'm using this code to pull in queries and I'm wondering how to loop through reference rows. So the 1st query is in C69, the last is in C80. Each new query would start in row after the last entry of the previous one.

VBA Code:
Dim rngAnchor As Range
Dim strQuery As String
        
strQuery = ws6.Range("C69")
     
With ws2
    Set rngAnchor = .Range("A2")
        With .QueryTables.Add(Connection:=strQuery, Destination:=rngAnchor)
            .Refresh BackgroundQuery:=False
        End With
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        .Rows("3:" & LastRow).RowHeight = 12
End With
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
To clarify the queries are URL links in C69-C80, that I'm looking to pull into one spreadsheet.
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,927
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top