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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

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,514
Messages
5,548,500
Members
410,841
Latest member
rcp
Top