Removing Hyperlinks with a macro

Mr Roboto

New Member
Joined
Sep 27, 2003
Messages
46
I have a worksheet that has over 5000 rows. Each row in column A has a hyperlink that I want to remove. I want to keep want is typed in the cell just remove the hyperlink. How do I create a macro that will delete the hyperlink then go to the next row and repeat until it comes to a blank cell.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try this

Rich (BB code):
'---------------------------------------------------------------------------------------
' Module    : Module1
' DateTime  : 05/11/2005 07:53
' Author    : royUK
' Website   : www.excel-it.com
' Purpose   : Remove hyperlinks
'---------------------------------------------------------------------------------------
Option Explicit

Sub deleteHLink()
    Dim rngHLinks As Range
    Dim h As Hyperlink
    
    Set rngHLinks = ActiveSheet.Range("a1", Range("a65536").End(xlUp))
    For Each h In rngHLinks
        h.Delete
    Next h
End Sub
 
Upvote 0
Thanks for the reply, but it did not work.
I get a Run Time error 13 - type mismatch for the following line
For Each h In rngHLinks
 
Upvote 0
Sorry, I missed a bit. you need to add .Hyperlinks as below

Rich (BB code):
Option Explicit

'---------------------------------------------------------------------------------------
' Module    : Module1
' DateTime  : 05/11/2005 07:53
' Author    : royUK
' Website   : www.excel-it.com
' Purpose   : Remove hyperlinks
'---------------------------------------------------------------------------------------


Sub deleteHLink()
    Dim rngHLinks As Range
    Dim h As Hyperlink
    
    Set rngHLinks = ActiveSheet.Range("a1", Range("a65536").End(xlUp))
    For Each h In rngHLinks.Hyperlinks
        h.Delete
    Next h
End Sub
 
Upvote 0

Forum statistics

Threads
1,226,227
Messages
6,189,753
Members
453,567
Latest member
kentbarbie

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