Results 1 to 2 of 2
  • Thread Tools
  1. Lounger
    Join Date
    Jan 2009
    Thanked 0 Times in 0 Posts

    copying and pasting a hyperlink in VBA Excel 2003

    Need some help tweaking the VBA. This code works fine other than I am copying a hyperlink in line "Cells(2, 3).Value = Cells(rw, 7).Value"
    While it copies the text fine, it doesn't copy the hyperlink. Is there a way to copy the hyperlink?


    Sub coverletter()

    Dim shInv As Worksheet

    Set shInv = ThisWorkbook.Sheets("Cover Letter")
    If Selection.Column <> 6 Or Selection.Value = "" Then
    MsgBox "There is nothing to export!" & Chr(10) & "Select a cell with data from column F," & Chr(10) & "and try again"
    Exit Sub
    End If
    rw = Selection.Row
    With shInv
    .Cells(2, 3).Value = Cells(rw, 7).Value
    .Cells(3, 3).Value = Cells(rw, 9).Value
    .Cells(3, 10).Value = Cells(rw, 8).Value
    .Cells(4, 3).Value = Cells(rw, 10).Value
    .Cells(4, 9).Value = Cells(rw, 15)

    End With
    Cells(rw, "F").Select
    End Sub

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Burwash, East Sussex, United Kingdom
    Thanked 77 Times in 73 Posts
    Perhaps change it to:
    Cells(rw, 7).Copy Destination:=.Cells(2, 3)
    Microsoft MVP - Excel.

Posting Permissions

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