Results 1 to 3 of 3

Pull web data from multiple cell references using VBA

Threaded View

  1. #1
    Registered User
    Join Date
    07-09-2011
    Location
    NY
    MS-Off Ver
    2010
    Posts
    3

    Pull web data from multiple cell references using VBA

    I'd appreciate any help I can get. Thanks!

    What I am trying to accomplish:

    I have a list of websites in column B of my "Links" tab. (The # of links may vary)
    I want to export data from each website in a loop into cell B1 in my "Results" tab
    I want to paste the resulting summary info into my "Summary" tab. Cells A2:AK3 contain the information and i want to paste the results starting in cell A5 on my Summary tab and for each new website, paste 2 rows below where I previously pasted the info.

    The code I have now is the begginning of what I think I need to do. I am getting an error in the ".Refresh BackgroundQuery:=False" line of code.
            Sub Loops()
        Dim i As Long
        
            For i = 3 To Cells(Rows.Count, "B").End(xlUp).Row
             ActiveWorkbook.Worksheets.Add
         With ActiveSheet.QueryTables.Add(Connection:="URL;" & Range("$B$" & i).Value, Destination:=Range("$B$1"))
            .Name = Range("B" & i).Value
            .FieldNames = True
            .RowNumbers = False
            .FillAdjacentFormulas = False
            .PreserveFormatting = True
            .RefreshOnFileOpen = False
            .BackgroundQuery = True
            .RefreshStyle = xlInsertDeleteCells
            .SavePassword = False
            .SaveData = True
            .AdjustColumnWidth = True
            .RefreshPeriod = 0
            .WebSelectionType = xlSpecifiedTables
            .WebFormatting = xlWebFormattingNone
            .WebTables = "2,3,7"
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
            Next i
    Last edited by Leith Ross; 07-09-2011 at 01:01 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1