hyperlink check - macros

Lochnagar

New Member
Joined
Jan 28, 2008
Messages
43
Hi All,

I have a list of documents in excel (i.e. a document per cell), with some hyperlinked to their respective locations. What I'm wanting to do is delete the cells that contain a documents name, which isn't hyperlinked. And keep the ones with hyperlinks. Is it possible to check whether a cell contains a hyperlink using macros? i.e. is there a piece of code that returns TRUE or FALSE depending on whether a cell has a hyperlink or not.

Any advise (other than don't quit your day job:) ) or help will be hugely appreciated.

Thanks,
Lochnagae
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
try adjusting this to suit your needs. Try on a copy of your data as it's untested
Code:
For Each cell In Rng
    Select Case cell.Hyperlinks.Count
        Case Is > 0
            Select Case IsError(Evaluate(cell.Hyperlinks(1).SubAddress))
                Case 0
                    hyper_st = Replace(Left(cell.Hyperlinks(1).SubAddress, InStr(cell.Hyperlinks(1).SubAddress, "!") - 1), "'", "")
                    
                Case 1
                    EntireRow.Delete
            End Select
    End Select
Next cell
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,946
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top