Clearing Hyperlink formating from undefined # of cells in a column
This is a bit overkill but the function allows you to specify a single sheet
to remove the hyperlinks from, or defaults to removing all links in the
workbook. The function also returns the total number of links that it removed
should you have any reason for it.
'Remove all hyperlinks in a workbook or specific sheet
Private Function iRemoveHyperlinks(Optional ByVal ssheet_name As String =
"Workbook") As Integer
Dim vworksheet As Variant
Dim vlink As Variant
Dim itotal_links_Removed As Integer
itotal_links_Removed = 0
ssheet_name = UCase(ssheet_name)
For Each vworksheet In ThisWorkbook.Sheets
'If a single sheet is defined, remove links only from that sheet.
'otherwise remove links from entire workbook
If ssheet_name < "WORKBOOK" Then
If UCase(vworksheet.Name) = ssheet_name Then
itotal_links_Removed = itotal_links_Removed +
vworksheet.Cells.Hyperlinks.Count
vworksheet.Cells.Hyperlinks.Delete
End If
Else
itotal_links_Removed = itotal_links_Removed +
vworksheet.Cells.Hyperlinks.Count
vworksheet.Cells.Hyperlinks.Delete
End If
Next vworksheet
iRemoveHyperlinks = itotal_links_Removed
End Function
Happy metrix'n
Derek P.
|