mmcompact
asked on
Convert selected cells to web address link
In a sheet, there are cells contain something link "mydomain.com", "mydomain.info", "mydomain.org"...
Once I select them, I want to run a VBA that will convert the text to hyperlinks "http://www.mydomain.com", but keep its original formatting and without showing "http://www."
Once I select them, I want to run a VBA that will convert the text to hyperlinks "http://www.mydomain.com", but keep its original formatting and without showing "http://www."
Without using VBA, you can right click the cell and then Insert a hyperlink.
In your example, mydomain.org you can type in the hyperlink address box as www.mydomain.org
Sincerely,
Ed
In your example, mydomain.org you can type in the hyperlink address box as www.mydomain.org
Sincerely,
Ed
If you want to select more than one and apply it, try this instead:
Sub AddHyperlink()
Dim objCell As Range
For Each objCell In Selection
ActiveSheet.Hyperlinks.Add Anchor:=objCell, Address:= _
"http://www." & objCell.Value, TextToDisplay:=objCell.Val ue
Next
End Sub
Sub AddHyperlink()
Dim objCell As Range
For Each objCell In Selection
ActiveSheet.Hyperlinks.Add
"http://www." & objCell.Value, TextToDisplay:=objCell.Val
Next
End Sub
ASKER
rspahitz:
your solution works, but it changed the text formatting to system default. Can I keep the original formatting, like font, font size, no underline etc...
your solution works, but it changed the text formatting to system default. Can I keep the original formatting, like font, font size, no underline etc...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
cool, thanks
Sub AddHyperlink()
ActiveSheet.Hyperlinks.Add
"http://www." & ActiveCell.Value, TextToDisplay:=ActiveCell.
End Sub