Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How will hyperlink cell reference update after copy paste? | Excel Worksheet Functions | |||
Hyperlink Update | Excel Worksheet Functions | |||
Hyperlink Update? | Excel Discussion (Misc queries) | |||
Follow hyperlink but don't update links....is it possible ? | Excel Programming | |||
Update links - hyperlink issues | Excel Discussion (Misc queries) |