Consulting

Results 1 to 2 of 2

Thread: links

  1. #1

    links

    i have a spreadsheet with links, i wish to remove these links but retain the infomation.

    how can this be done?

  2. #2
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    If you also want to lose the worksheet formulas...

    [vba]Option Explicit
    '
    Sub DeleteLinksAndFormulas()
    With Cells
    .Copy
    .PasteSpecial Paste:=xlPasteValues
    .Hyperlinks.Delete
    End With
    End Sub[/vba]

    If you want to keep the other worksheet formulas, use...
    [vba]Option Explicit
    '
    Sub DeleteLinksOnly()
    Dim Cell As Range, FirstAddress As String, Temp As String
    '
    Application.ScreenUpdating = False
    With ActiveSheet.UsedRange
    Set Cell = .Find("=*!", LookIn:=xlFormulas, LookAt:=xlPart)
    On Error GoTo Finish
    FirstAddress = Cell.Address
    Do
    Temp = Cell
    Cell.ClearContents
    Cell = Temp
    Set Cell = .FindNext(Cell)
    Loop Until Cell Is Nothing Or Cell.Address = FirstAddress
    .Hyperlinks.Delete
    End With
    Application.ScreenUpdating = True
    End Sub[/vba]
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

Posting Permissions

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