Results 1 to 20 of 26

Thread: Sleeper: Loop through range to copy/paste hyperlink

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #13

    from where to run the code

    Quote Originally Posted by xld

    Dim sh As Worksheet
    Dim iLastRow As Long
    I open my workbook and run this code, but it only executes on the worksheet my cursor is on. How do I get it to execute for all sheets?

    Dim sURL As String
    Dim i As Long
    For Each sh In ThisWorkbook.Worksheets
    With sh
    iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    sURL = .Cells(i, "A").Value
    If Left(sURL, 7) <> "http://" Then
    sURL = "http://" & sURL
    End If
    .Hyperlinks.Add Anchor:=.Cells(i, "A"), Address:=sURL
    Next i
    End With
    Next sh
    Last edited by pdeshazier; 05-30-2005 at 11:41 AM. Reason: typed in wrong place

Posting Permissions

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