V
Victor Delta
Using Excel 2003, I have three macros which I run, as appropriate, to the
format 3 types of hyperlink correctly. They are shown below.
What would be really helpful would be to combine them into one macro which
does the following to the cells, or cells, selected:
* First tests whether the cell(s) contain a hyperlink
* If so, applies the appropriate macro depending on which of the 3
types it is.
I've tried a few 'if' functions but so far VB has beaten me. Can anyone
help please?
Many thanks,
V
Sub MakeEmailHyperlinks()
For Each objCell In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:="mailto:" &
objCell.Value, TextToDisplay:=objCell.Value
Next
End Sub
Sub MakeWebHyperlinks()
For Each objCell In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:="http://" &
objCell.Value, TextToDisplay:=objCell.Value
Next
End Sub
Sub MakeFileHyperlinks()
For Each objCell In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:="file:///" &
objCell.Value, TextToDisplay:=objCell.Value
Next
End Sub
format 3 types of hyperlink correctly. They are shown below.
What would be really helpful would be to combine them into one macro which
does the following to the cells, or cells, selected:
* First tests whether the cell(s) contain a hyperlink
* If so, applies the appropriate macro depending on which of the 3
types it is.
I've tried a few 'if' functions but so far VB has beaten me. Can anyone
help please?
Many thanks,
V
Sub MakeEmailHyperlinks()
For Each objCell In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:="mailto:" &
objCell.Value, TextToDisplay:=objCell.Value
Next
End Sub
Sub MakeWebHyperlinks()
For Each objCell In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:="http://" &
objCell.Value, TextToDisplay:=objCell.Value
Next
End Sub
Sub MakeFileHyperlinks()
For Each objCell In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:="file:///" &
objCell.Value, TextToDisplay:=objCell.Value
Next
End Sub