+ Reply to Thread
Results 1 to 1 of 1

Find Url If Missing Move On

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    11-15-2007
    Location
    England
    MS-Off Ver
    Office Pro 2003 / 2010
    Posts
    423

    Find Url If Missing Move On

    Hi,

    One of the forum members gave me this piece of code to run down column A starting at A2 on a sheet called urls. It goes to the relevant url copies the data adds a sheet and pastes the data into it.

    Works perfectly with one small exception if the url has been removed then it can't find anything and it stops at -

       .Refresh BackgroundQuery:=False
    Could anyone give me a piece of code to add so that of the url isn't found it moves onto the next? i.e. if the url in a33 can't be found it moves to a34 and so on.

    Many thanks.

     
    Sub su()
    
    Dim val, countofhyperlink As Integer
    
    
    
    
    For i = 2 To 2 ' here add the number of hyperlinks you have.
    
    
    
    val = "a" & i ' add the hyperlinks in sheet 1
    MsgBox val
    
    v = Sheets("Sheet1").Range(val).Value
    MsgBox v
    vc = "URL;" & v
    
    
    Sheets.Add
           With ActiveSheet.QueryTables.Add(Connection:=vc, Destination _
            :=Range("$A$1"))
            .Name = "members.aspx?mgid= v"
            .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 = """MembersGrid"""
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
            
    End With
    
      
    Next
    Last edited by timbo1957; 05-14-2013 at 04:11 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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