Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Removing hyperlink without removing the font settings /border sett

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
San - 27 Sep 2007 15:34 GMT
The below code removes hyperlinks
Sub ZapHyperlinks()
  Cells.Hyperlinks.Delete
End Sub
However it also removes the formatting(color/border) of the cell .
Any idea on how to protect the format of the cell
Tom Ogilvy - 27 Sep 2007 15:58 GMT
Maybe something like this:

Sub ZapHyperlinks()
 Set sh = ActiveSheet
 ActiveSheet.Copy After:=Worksheets(Worksheets.Count)
  Set sh1 = ActiveSheet
  sh.Activate
  Set r = Selection
   Cells.Hyperlinks.Delete
  sh1.Cells.Copy
  sh.Cells.PasteSpecial xlFormats
  r.Select
  Application.DisplayAlerts = False
    sh1.Delete
  Application.DisplayAlerts = True
End Sub

Signature

Regards,
Tom Ogilvy

> The below code removes hyperlinks
> Sub ZapHyperlinks()
>    Cells.Hyperlinks.Delete
> End Sub
> However it also removes the formatting(color/border) of the cell .
> Any idea on how to protect the format of the cell
Gary''s Student - 27 Sep 2007 16:37 GMT
Another way:

Sub hyper_be_gone()
For Each r In ActiveSheet.UsedRange
   If r.Hyperlinks.Count > 0 Then
       r.ClearContents
   End If
Next
End Sub

Signature

Gary''s Student - gsnu200747

> The below code removes hyperlinks
> Sub ZapHyperlinks()
>    Cells.Hyperlinks.Delete
> End Sub
> However it also removes the formatting(color/border) of the cell .
> Any idea on how to protect the format of the cell
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.