VBA ClearHyperlinks in Excel Explained with Examples

We can use VBA clearhyperlinks to Clear only the Hyperlinks in a specific range, cells or entire worksheet. We can use ClearHyperlinks method of Range Object. Rang.ClearHyperlinks method will clear only the hyperlinks in a range. And data and the formats like border, font styles, background cell will remain same and will not be disturbed.



50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates

VBA ClearHyperlinks Method Excel Range Object

Excel VBA to ClearHyperlinks in a Range – Syntax

Here is the syntax to clear the Hyperlinks in a range. You can clear the hyperlinks in any range using VBA Range.ClearHyperlinks method.


Excel VBA to ClearHyperlinks in a Range – Examples

The below macro will show you how to clear the Hyperlinks in a range using VBA. In this example, we are clearing the data in range “A2 to D10” using VBA.

Sub VBA_Clear_Hyperlinks_Range()
End Sub

Excel VBA to Clear Hyperlinks in a Range – Instructions

Please follow the below step by step instructions to execute the above mentioned VBA macros or codes:

  1. Open an Excel Workbook from your start menu or type Excel in your run command
  2. Enter some data in any cells in range “A10 to D10” to test this macro. Also format some cell and insert some hyperlinks to test.
  3. Press Alt+F11 to Open VBA Editor or you can go to Developer Table from Excel Ribbon and click on the Visual Basic Command to launch the VBA Editor
  4. Insert a Module from Insert Menu of VBA
  5. Copy the above code (for clearing Hyperlinks in a range using VBA) and Paste in the code window(VBA Editor)
  6. Save the file as Macro Enabled Workbook (i.e; .xlsm file format)
  7. Press ‘F5′ to run it or Keep Pressing ‘F8′ to debug the code line by line.

Now you can observe that the hyperlinks in the range “A2 to D10” is cleared. You can apply any formats and background color, and try this macro. This will clear only the hyperlinks. Data, formats, comments will be remained same.

If you want to clear everything including formats and data, you can use Range.Clear method, to clear the comments in a range you use the Range.ClearComments method.

Range.ClearHyperlinks: Will clear only the Hyperlinks in a range. Formats, comments, data will remain same.
Range.Clear: Will clear the data including cell formats.
Range.ClearComments: Will clear only the comments, formats and data will remain then same.


Leave A Comment

Related pages

vlook functionexcel tracker templatesrange lookup vlookupvba loop exampleexcel 2010 macro securityadd developer tab to ribbon microsoft wordbeginner excelenter vbalogical formulas in exceladvanced vba tutorial pdfexcel query databasevba tutorials pdfexcel forms vbahow to unprotect excel workbook without passwordvba codes examplesvba rshow to use name manager in excel 2007how to use choose function in excelclose msgbox vbadelete rows in excel vbanested if function in excel 2010vba application runvlookup funtionchanging rows to columns in excelactivate sheet vbamacro programming in excelhlookup examplescount duplicate values in excelfilecopy vbaexcel write macrovlookup in excel 2007 with example in exceltutorial excel vlookupvba copy rowpivot table basicsmultiple criteria vlookupiserror in excelvba excel tutorialsvba code to import text file into excelexcel vba status bar progressvb clear listboxvbs write filewriting sql queries in excelvba concatenate functionddl dml tclcombine columns in excel 2007if statements in excel 2007sql queries excelmultiple criteria exceldynamic chart title excel 2010vba file existsactivesheet listobjectsmsgbox vba yes nosample xlsm file downloadinteractive charts in excel 2010learn formulas in excelexport from access to excel vbahow to deduplicate in excelmicrosoft excel macro tutorialconcatenate function exceltypes of charts in spreadsheetmerging worksheets in excelvb sample programs pdfhow to unhide all worksheets in excelexcel concatenatesimple macro in excelapplication formula vbaactivex tutorialvba instrlist box controlexcel workbook examplestemplate dashboard excelvbscript parse text fileelse vbaexcel macro delete columninstr exampleexcel vba string containsexcel hiding columnsvba debug printstring to int vbafso.copyfileexcel tutorial vlookupvba entirecolumn