Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Mar 2006
    Posts
    76
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Macro for WebQuery

    So, i have a macro which runs web-queries to 30 tabs, however ive found that a number of the parameters, do not point to web pages contain the data i need, which is allright. but i need a way to bypass the query that isnt found and continue on to run the remaining queries in the workbook...
    below is a sample of the vba...what do i need to add to skip over the non responsive query?
    Sheets("Dashboard").Select
    If Range("a12") <> "" Then
    Sheets("Sheet3").Select
    Range("A1").Select
    Selection.QueryTable.Refresh BackgroundQuery:=False
    End If
    Sheets("Dashboard").Select
    If Range("a13") <> "" Then
    Sheets("Sheet4").Select
    Range("A1").Select
    Selection.QueryTable.Refresh BackgroundQuery:=False
    End If

    thanks for any assistance you can provide.

  2. #2
    Star Lounger
    Join Date
    Mar 2006
    Posts
    76
    Thanks
    6
    Thanked 0 Times in 0 Posts
    Just wondering if anyone has a solution? As the workbook auto runs through populating the results of 20 web queries, what code do i need to bypass an unavailable query? Say, the web page for query #5 isnt available how do i skip over it and go to query # 6 of 20?

  3. #3
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,823
    Thanks
    135
    Thanked 482 Times in 459 Posts
    Hi

    ..a quick and dirty solution would be to add this line at the start of your routine..
    On Error Resume Next

    At the end of your routine, you could then tidy up by 'turning off' this error trapping using
    On Error GoTo 0

    zeddy

  4. The Following User Says Thank You to zeddy For This Useful Post:

    Unome (2016-04-19)

  5. #4
    Star Lounger
    Join Date
    Mar 2006
    Posts
    76
    Thanks
    6
    Thanked 0 Times in 0 Posts
    That worked perfectly, thanks!

Posting Permissions

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