ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to remove hyperlink from a cell using VBA code (https://www.excelbanter.com/excel-programming/338994-how-remove-hyperlink-cell-using-vba-code.html)

keithb

How to remove hyperlink from a cell using VBA code
 
Is there a way, using VBA code, to remove a hyperlink from a cell, while
retaining the cell text content?

Thanks,

Keith




Gary's Student

How to remove hyperlink from a cell using VBA code
 
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell, while
retaining the cell text content?

Thanks,

Keith





Norman Jones

How to remove hyperlink from a cell using VBA code
 
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.


Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in message
...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell, while
retaining the cell text content?

Thanks,

Keith







Norman Jones

How to remove hyperlink from a cell using VBA code
 
Hi Gary,

Please ignore my suggestion.

I missed the OP's requirement to *retain* the text!

My apologies.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.


Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in message
...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell, while
retaining the cell text content?

Thanks,

Keith









keithb

How to remove hyperlink from a cell using VBA code
 
Thanks for the help. One related question:

What properties of a Range can I set so that text within the range is not
interpreted as a URL in the first place?

Thanks again,

Keith

"Norman Jones" wrote in message
...
Hi Gary,

Please ignore my suggestion.

I missed the OP's requirement to *retain* the text!

My apologies.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.


Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in
message ...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell,
while
retaining the cell text content?

Thanks,

Keith











Tom Ogilvy

How to remove hyperlink from a cell using VBA code
 
Why, that should retain the text.

or just
Activesheet.Hyperlinks.delete

I believe will also do it.

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Gary,

Please ignore my suggestion.

I missed the OP's requirement to *retain* the text!

My apologies.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.


Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in

message
...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell,

while
retaining the cell text content?

Thanks,

Keith











Norman Jones

How to remove hyperlink from a cell using VBA code
 
Hi Tom,

Why, that should retain the text.


For me, the line

r.Clear


cleared the residual text and, hence, my apology.

---
Regards,
Norman



"Tom Ogilvy" wrote in message
...
Why, that should retain the text.

or just
Activesheet.Hyperlinks.delete

I believe will also do it.

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Gary,

Please ignore my suggestion.

I missed the OP's requirement to *retain* the text!

My apologies.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.

Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in

message
...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell,

while
retaining the cell text content?

Thanks,

Keith













Tom Ogilvy

How to remove hyperlink from a cell using VBA code
 
Well than all you needed to do was say to delete that line. Everything else
was good.

--
Regards
Tom Ogilvy


"Norman Jones" wrote in message
...
Hi Tom,

Why, that should retain the text.


For me, the line

r.Clear


cleared the residual text and, hence, my apology.

---
Regards,
Norman



"Tom Ogilvy" wrote in message
...
Why, that should retain the text.

or just
Activesheet.Hyperlinks.delete

I believe will also do it.

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Gary,

Please ignore my suggestion.

I missed the OP's requirement to *retain* the text!

My apologies.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.

Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in

message
...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell,

while
retaining the cell text content?

Thanks,

Keith















Norman Jones

How to remove hyperlink from a cell using VBA code
 
Hi Tom,

Well than all you needed to do was say to delete that line. Everything
else
was good


The 'good' part was Gary's Student's code.

My sole contribution was the offending line - hence my apology!


---
Regards,
Norman



"Tom Ogilvy" wrote in message
...
Well than all you needed to do was say to delete that line. Everything
else
was good.

--
Regards
Tom Ogilvy


"Norman Jones" wrote in message
...
Hi Tom,

Why, that should retain the text.


For me, the line

r.Clear


cleared the residual text and, hence, my apology.

---
Regards,
Norman



"Tom Ogilvy" wrote in message
...
Why, that should retain the text.

or just
Activesheet.Hyperlinks.delete

I believe will also do it.

--
Regards,
Tom Ogilvy

"Norman Jones" wrote in message
...
Hi Gary,

Please ignore my suggestion.

I missed the OP's requirement to *retain* the text!

My apologies.

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Gary's Student,

Try this. On my machine the link is gone, but the text lingers on.

Try adding an additional line:

Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
r.Clear
Next
End Sub

---
Regards,
Norman



"Gary's Student" wrote in
message
...
Sub hypergone()
Dim r As Range
For Each r In Selection
r.Hyperlinks.Delete
Next
End Sub

Try this. On my machine the link is gone, but the text lingers on.
--
Gary's Student


"keithb" wrote:

Is there a way, using VBA code, to remove a hyperlink from a cell,
while
retaining the cell text content?

Thanks,

Keith


















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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com