+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24

Thread: hyperlinks

  1. #16
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,151

    Re: hyperlinks

    Hey

    Ive placed it it the code
    Option Explicit
    Sub Port()
       Dim sht1 As Worksheet
       Dim qryTbl As QueryTable
       Dim XRow As Variant
       Dim Nrow As String
       Set sht1 = ThisWorkbook.Worksheets("Here")
    
        For Each XRow In Range("B2", Cells(Rows.Count, 2).End(xlUp))' it replaces this bit
        Nrow = XRow.Address
       Set qryTbl = sht1.QueryTables.Add(Connection:="URL;" & XRow, _
       Destination:=sht1.Range("A1"))
    
       With qryTbl
           .BackgroundQuery = True
           .WebSelectionType = xlSpecifiedTables
           .WebTables = "1,3"
           .WebFormatting = xlWebFormattingAll
           .Refresh BackgroundQuery:=False
           .SaveData = True
       End With
      
       With sht1
          .Range("C1").Copy Destination:=Sheets("links").Range(Nrow).Offset(0, 1)
       .Range("B7").Copy Destination:=Sheets("links").Range(Nrow).Offset(0, 2)
       End With
        Sheets("Here").Select
        Cells.Select
        Selection.Delete Shift:=xlUp
        Sheets("links").Select
    Next XRow
    End Sub
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  2. #17
    Registered User
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: hyperlinks

    HI,
    this makro is very time consuming. does anyone know how to speed up this process? maybe to use just one worksheet, instead of two would help a bit...
    maybe someone has any better ideas. I appreciate any advise or update in the code.
    THANKS
    Last edited by afgi; 10-19-2010 at 10:44 AM.

  3. #18
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: hyperlinks

    sub snb()
      sq=application.transpose(columns(2).specialcells(2))
      With ThisWorkbook.sheets("Here")
        For j=2 to ubound(sq)   
          If .querytables.count=0 then 
            With .QueryTables.Add("URL;" & sq(1),.[A1])
              .WebSelectionType = xlSpecifiedTables
              .WebTables = "1,3"
              .WebFormatting = xlWebFormattingAll
              .Refresh False
              .SaveData = True
            End With
          else
            With .querytables(1)
              .connectionstring=sq(j)
              .refresh False
            End with
          End if
          Do
            Doevents
          Loop until .[C1]<>""
    
          Sheets("links").Range(j).Offset(0, 1)=.[C1]
          Sheets("links").Range(j).Offset(0, 2)=.[B7]
          .[C1].clearcontents
        End With
      Next
    End Sub



  4. #19
    Registered User
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: hyperlinks

    Dear Snb,

    I get an error on "End with", so it does not work for me... thanks for any feedback

  5. #20
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: hyperlinks

    No objection to your analysing the code and fixing this error.



  6. #21
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: hyperlinks

    Move the "Next" above the "end with"

  7. #22
    Registered User
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: hyperlinks

    Dear Snb,

    could you pls attache your file you are workin on. it really does not work on my computer. I doubt it is because of language or different region

    Dear Romperstomper,

    it suspends on yours

  8. #23
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    Apparently I can't say
    MS-Off Ver
    Apparently I can't say
    Posts
    8,274

    Re: hyperlinks

    I was just saying that those two lines were in the wrong order. I make no comment about the functionality of the code itself.

  9. #24
    Registered User
    Join Date
    09-13-2010
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: hyperlinks

    hi,

    so do you have any idea why it is not working in my excel?? thanks for any help in advance

+ 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.2.0