Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Update hyperlink value with cell value

Excel 2002 SP3

I would like to know how to achieve the following with a vba script or macro:

verify if the value of a hyperlink is the same a the value of the cell, e.g.
if the value of a cell is and the email hyperlink value is

then - ok (leave as it is)

but

if the value of a cell is
and the email hyperlink value is

then - not ok (update email hyperlink with value of the cell)

and
when the cell is empty and hyperlink is filled in, cell should be updated.



Can this be scripted?
Thanks for any help as I don't seem to manage it right now.


Regards,
Bert
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Update hyperlink value with cell value

Sub hyperfix()
Dim h As Hyperlink
For Each h In ActiveSheet.Hyperlinks
If h.TextToDisplay = "" Then
Else
h.Address = "mailto:" & h.TextToDisplay
End If
Next
End Sub

This version will ignore cells that do not display anything.
--
Gary''s Student - gsnu200740


"Bert" wrote:

thanks a lot for the solution. It does what it should except on thing.

Can you build in this that when the cell value is empty, nothing should
happen?

"Gary''s Student" wrote:

This assumes that the displayed text does NOT include mailto:
If the displayed text is something like:



then:

Sub hyperfix()
Dim h As Hyperlink
For Each h In ActiveSheet.Hyperlinks
h.Address = "mailto:" & h.TextToDisplay
Next
End Sub

--
Gary''s Student - gsnu200740


"Bert" wrote:

Excel 2002 SP3

I would like to know how to achieve the following with a vba script or macro:

verify if the value of a hyperlink is the same a the value of the cell, e.g.
if the value of a cell is
and the email hyperlink value is

then - ok (leave as it is)

but

if the value of a cell is
and the email hyperlink value is

then - not ok (update email hyperlink with value of the cell)

and
when the cell is empty and hyperlink is filled in, cell should be updated.



Can this be scripted?
Thanks for any help as I don't seem to manage it right now.


Regards,
Bert

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Update hyperlink value with cell value

Gary,


The first sub did really what had to be done, but with the new version,
after selecting the column where it need to be applied to and running this
saved macro, nothing happend.
Cells with a wrong hyperlink still had this after running the script.

Do I need to add something in the line
If h.TextToDisplay = "" Then

Because I'm not sure that if either the displayed cell or the hyperlink cell
is not empty, this doesn't apply to it...

Does this script take into account that we are talking about two different
values?




"Gary''s Student" wrote:

Sub hyperfix()
Dim h As Hyperlink
For Each h In ActiveSheet.Hyperlinks
If h.TextToDisplay = "" Then
Else
h.Address = "mailto:" & h.TextToDisplay
End If
Next
End Sub

This version will ignore cells that do not display anything.
--
Gary''s Student - gsnu200740


"Bert" wrote:

thanks a lot for the solution. It does what it should except on thing.

Can you build in this that when the cell value is empty, nothing should
happen?

"Gary''s Student" wrote:

This assumes that the displayed text does NOT include mailto:
If the displayed text is something like:



then:

Sub hyperfix()
Dim h As Hyperlink
For Each h In ActiveSheet.Hyperlinks
h.Address = "mailto:" & h.TextToDisplay
Next
End Sub

--
Gary''s Student - gsnu200740


"Bert" wrote:

Excel 2002 SP3

I would like to know how to achieve the following with a vba script or macro:

verify if the value of a hyperlink is the same a the value of the cell, e.g.
if the value of a cell is
and the email hyperlink value is

then - ok (leave as it is)

but

if the value of a cell is
and the email hyperlink value is

then - not ok (update email hyperlink with value of the cell)

and
when the cell is empty and hyperlink is filled in, cell should be updated.



Can this be scripted?
Thanks for any help as I don't seem to manage it right now.


Regards,
Bert

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How will hyperlink cell reference update after copy paste? bjry Excel Worksheet Functions 2 May 12th 09 05:10 PM
Hyperlink Update Douglas Excel Worksheet Functions 0 September 18th 08 08:31 AM
Hyperlink Update? gatz Excel Discussion (Misc queries) 0 June 5th 07 08:19 PM
Follow hyperlink but don't update links....is it possible ? nx3 Excel Programming 1 June 16th 06 03:51 PM
Update links - hyperlink issues Shan Excel Discussion (Misc queries) 0 March 3rd 05 01:57 PM


All times are GMT +1. The time now is 09:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"