Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Jan 2009
    Posts
    43
    Thanks
    0
    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?

    Thanks,

    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
    shInv.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. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,870
    Thanks
    0
    Thanked 78 Times in 74 Posts
    Perhaps change it to:
    Code:
    Cells(rw, 7).Copy Destination:=.Cells(2, 3)
    Regards,
    Rory
    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
  •