PC Review


Reply
Thread Tools Rate Thread

Clearing Hyperlink formating from undefined # of cells in a column

 
 
Phia
Guest
Posts: n/a
 
      12th Sep 2008
I pull metrics on a weekly basis, which include the hyperlink format in the
worksheet. I need to remove the hyperlink in order to remove the headache of
someone reading the report and accidently clicking on the hyperlink and going
no-where.

Right now I manually select each cell in the same column and right mouse
click to remove each hyperlink. If my report is over 100+ rows in length,
this can get tedious and take a long time. So, how do I create a vb
program/macro that will allow me to select the first cell in the column,
remove the hyperlink format, then select the next cell, and continue clearing
the format until there is no more entries in the column?

I've tried to use Range, but there doesn't appear to be a clear format
parameter available. Any help is very much appreciated!
--
Think of all the beauty still around you and be happy-Anne Frank

Sophia
 
Reply With Quote
 
 
 
 
Derek P.
Guest
Posts: n/a
 
      13th Sep 2008
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.


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      13th Sep 2008
You could use a macro that removes the hyperlinks from the selection.

Option Explicit
Sub testme()
With Selection
.Hyperlinks.Delete
.Style = "Normal"
End With
End Sub

Select the range to fix first. (Selecting all the cells is ok, too.)

Phia wrote:
>
> I pull metrics on a weekly basis, which include the hyperlink format in the
> worksheet. I need to remove the hyperlink in order to remove the headache of
> someone reading the report and accidently clicking on the hyperlink and going
> no-where.
>
> Right now I manually select each cell in the same column and right mouse
> click to remove each hyperlink. If my report is over 100+ rows in length,
> this can get tedious and take a long time. So, how do I create a vb
> program/macro that will allow me to select the first cell in the column,
> remove the hyperlink format, then select the next cell, and continue clearing
> the format until there is no more entries in the column?
>
> I've tried to use Range, but there doesn't appear to be a clear format
> parameter available. Any help is very much appreciated!
> --
> Think of all the beauty still around you and be happy-Anne Frank
>
> Sophia


--

Dave Peterson
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      13th Sep 2008
Are the hyperlinks created using the =HYPERLINK function?

If so, the following won't work

Sub DelAllHyperlinks()
ActiveSheet.HyperLinks.Delete
End Sub


Gord Dibben MS Excel MVP

On Fri, 12 Sep 2008 15:19:01 -0700, Phia <(E-Mail Removed)>
wrote:

>I pull metrics on a weekly basis, which include the hyperlink format in the
>worksheet. I need to remove the hyperlink in order to remove the headache of
>someone reading the report and accidently clicking on the hyperlink and going
>no-where.
>
>Right now I manually select each cell in the same column and right mouse
>click to remove each hyperlink. If my report is over 100+ rows in length,
>this can get tedious and take a long time. So, how do I create a vb
>program/macro that will allow me to select the first cell in the column,
>remove the hyperlink format, then select the next cell, and continue clearing
>the format until there is no more entries in the column?
>
>I've tried to use Range, but there doesn't appear to be a clear format
>parameter available. Any help is very much appreciated!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Converting text to Hyperlink cells in a column Don Guillett Microsoft Excel Worksheet Functions 1 26th Dec 2006 09:21 PM
How do I clear a column of data without clearing specific cells? =?Utf-8?B?RWxsZW5Td2FydHM=?= Microsoft Excel Misc 2 5th Apr 2006 05:07 PM
How to copy the hyperlink of a list of cells in another column jaya Microsoft Excel Discussion 2 8th Oct 2005 04:11 PM
How to copy the hyperlink of a list of cells in another column jaya Microsoft Excel Worksheet Functions 1 8th Oct 2005 03:34 PM
Formating column cells Amjad Microsoft Excel Programming 1 9th Jan 2004 11:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:06 PM.