Nilesh’s Weblog

August 18, 2008

Hyperlinks in Excel

Filed under: Microsoft Excel — Tags: , — deshnilesh @ 5:12 pm

Well here’s one more excel trick which I learned today. I had a file which was having hyperlinks to all of its cells and I wanted to get rid of it. Here’s the code which will do it for you in seconds!! –

Sub RemoveAllHyperlinks()
‘Remove all hyperlinks from the active sheet
ActiveSheet.Hyperlinks.Delete
End Sub

If you want to remove Hyperlinks from all the sheets then just add a loop to browse thru all sheets and then remove the hyperlinks or write a procedure to browse thru the sheets and then call above procedure.

Sub RemoveAllHyperlinksFromAllSheets()
‘Remove all hyperlinks from all sheet
Dim varSheet As Worksheet
For Each varSheet In ActiveWorkbook.Worksheets
varSheet.Hyperlinks.Delete
Next
End Sub

What if you want to remove hyperlinks for a particular range? That is also not a problem just select the cells and run the code –

Sub RemoveHyperlinksForSelectedCells()
‘Remove all hyperlinks from selected cells
For Each cell In Selection
cell.Hyperlinks.Delete
Next
End Sub
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: