Showing Visited Hyperlinks

Written by Allen Wyatt (last updated December 24, 2022)
This tip applies to Excel 2000, 2002, and 2003


Jack likes his Excel hyperlinks to show that they have been visited. Unfortunately, when he saves his workbook, they all get reset to unvisited. Jack wonders if there is some way to make the "visited" status of his hyperlinks survive the Save operation.

There is no way to do this that we've been able to discover. The closest we can come is to check the whether a hyperlink is followed or not and then somehow indicate that status with a condition or value that survives a save operation. For instance, consider the following macros:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim wks As Worksheet
    Dim hl As Hyperlink
    Application.ScreenUpdating = False
    For Each wks In ThisWorkbook.Worksheets
        For Each hl In wks.Hyperlinks
            If hl.Parent.Interior.ColorIndex = 37 Then
                hl.Parent.Interior.ColorIndex = xlNone
                hl.Parent.Style = "Followed Hyperlink"
            End If
        Next hl
    Next wks
    Application.ScreenUpdating = True
End Sub
Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target As Hyperlink)
    Target.Parent.Interior.ColorIndex = 37
End Sub

Every time a hyperlink is followed, the second macro is run. It sets the color of the cell containing the hyperlink. Then, as the workbook is saved, the first macro is run. It checks all the cells containing hyperlinks, and if their interior color is the "key" color (color value of 37), then the style of the cell is set to a style named "Followed Hyperlink". This style setting for the cell will survive the save operation; the only thing you need to do is make sure that you've defined the style to appear as you want your followed hyperlinks to appear.

It should be pointed out that these two macros should be added to the ThisWorkbook module of the workbook. To get to it, display the Visual Basic Editor and double-click on the ThisWorkbook module in the Project Explorer. You can then paste the macros into the resulting code window.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the ExcelTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7198) applies to Microsoft Excel 2000, 2002, and 2003.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Removing Automatic Lines

Type a few dashes, underscores, or equal signs, and you could end up with a full-width line in your document. This is ...

Discover More

Document Shows as 'In Use' by Another User

Word tries to constantly track who is using various documents, in order to prevent two users from clashing in their edits ...

Discover More

Canceling a Command

Tired of waiting for a command to finish running? You can use the same shortcut to cancel a command that you use to ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (menu)

Extracting URLs from Hyperlinked Images

When copying information from the Internet to an Excel workbook, you may want to get rid of graphics but keep any ...

Discover More

Dynamic Hyperlinks in Excel

Hyperlinks to many types of Web sites rely on passing parameters in the URL. Knowing this, you can construct a dynamic ...

Discover More

Removing Hyperlinks without a Macro, Take Two

Need to get rid of hyperlinks in a worksheet? Here's an easy way to do it without using a macro.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is nine minus 1?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.