Loop Through Queries

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
553
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
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

helpexcel

Well-known Member
Joined
Oct 21, 2009
Messages
553
To clarify the queries are URL links in C69-C80, that I'm looking to pull into one spreadsheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,106
Messages
5,545,981
Members
410,716
Latest member
ellyna
Top