Solved

Macro for removing hyperlinks from spreadsheet

Posted on 2007-11-20
5
1,779 Views
Last Modified: 2010-04-21
Hi Experts,
I have an Excel spreadsheet that has hyperlinks randomly scattered in different cells within the spreadsheet, is there a way of having a macro that can remove all hyperlinks in the spreadsheet. Thanks
Sam
0
Comment
Question by:samirst
5 Comments
 
LVL 6

Accepted Solution

by:
chipconsult earned 250 total points
ID: 20318692
This will delete the hyperlink but the text will remain.

Sub test()
For Each hp In ActiveSheet.Hyperlinks
 hp.Delete
Next hp

End Sub

Claus Henriksen
0
 
LVL 81

Assisted Solution

by:zorvek (Kevin Jones)
zorvek (Kevin Jones) earned 250 total points
ID: 20318695
Public Sub RemoveHyperlinks()

   Dim Hyperlink As Hyperlink
   Dim Count As Long
   
   For Each Hyperlink In ActiveSheet.Hyperlinks
      Hyperlink.Delete
      Count = Count + 1
   Next Hyperlink
   
   MsgBox Count & " hyperlinks deleted."

End Sub

Kevin
0
 

Author Closing Comment

by:samirst
ID: 31410090
Guys, both solutions worked perfectly and have the exact timestamp when posted. So the best option is to split the points equally. Many thanks for your help.
Sam
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 20318747
Sub RemoveHyperlinks()
ActiveSheet.Hyperlinks.Delete
End Sub

will also do it.
Regards,
Rory
0
 
LVL 6

Expert Comment

by:chipconsult
ID: 20318985
A little add-on:
If you want to delete the text as well it is done with:

Sub RemoveHyperlinks()

For Each hl In ActiveSheet.Hyperlinks

    Range(hl.Range.Address).ClearContents

Next hl

End Sub

Claus Henriksen
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Word and Excel 2013 - Disabled Items List 3 50
Excel format formula for currency 15 22
Msbbox Notice (4 days) 27 58
Excel Drop Down List 13 29
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now