import Web-query, i.e. ".iqy file" inside a VBA code

drp92

New Member
Joined
May 23, 2013
Messages
17
Even though i can write little bit VB code, I am relative beginner, hence i would like if someone could help me with this.

I have set up a perfect loop, that changes cell values from named table

here is code:
Code:
Sub LoopThroughForEachCellInARange()


Dim OutputAddress As String
Dim rng As Range: Set rng = Application.Range("subIDType") 'value for B2
Dim cell As Range

Dim rng2 As Range: Set rng2 = Application.Range("mainID") 'value for B1
Dim cel2 As Range

For Each cel2 In rng2.Cells
    With cel2
        
        'Debug.Print .Value
        Worksheets("sheet1").Select
        Worksheets("sheet1").Range("B1") = .Value
        
        For Each cel In rng.Cells
            With cel
                
                'Debug.Print .Value  
                Worksheets("sheet1").Select
                Worksheets("sheet1").Range("B2") = .Value
                
            End With
        Next cel        
    End With
Next cel2

End Sub
now what i want is, i have set up a Web-Query that will take value for URL from the B4 and will get me the data.

How can I import/use the saved ".iqy file" inside above VBA code to take value from B4 as URL, OR
Have a web-query run to get data with B4 as URL



A sample dataset:


ABC
1mainIDValue will be taken from named tableFrom VBA
2subIDTypeValue will be taken from named tableFrom VBA
3coreIDVlookup Formula to look for corresponding coreID with ref to mainIDFormula
4ConcatenateConcatenate Formula that will combine 1,2,3 to form URLFormula

<tbody>
</tbody>
 

Forum statistics

Threads
1,081,860
Messages
5,361,734
Members
400,652
Latest member
cortexnotion

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top