Click to See Complete Forum and Search --> : Excel VBA question -- hyperlinks


November 4th, 1999, 08:23 AM
Is this possible: I'm pasting a group of URLs that are just in a regular text format into an Excel column. Is there a piece of code that will loop thru each cell in that column and convert the text URLs into regular hyperlinks (that actually go where they're supposed to when clicked?) I tried "paste as hyperlink" already but this doesn't seem to work correctly when more than one cell is being pasted. Thanks. prgtmp2@deja.com

November 5th, 1999, 06:26 AM
Create a button called button1 and place this code in the click event. now select the cells that need to be converted and click on the button. here is the code:

Dim myRange as Range
Dim myCell as Range
Sub Button1_Click()
set myRange = Application.Selection
for Each myCell In myRange.Cells
myCell.Hyperlinks.Add myCell, myCell.Value
next
End Sub




I hope the code is self-explanatory
Happy Diwali
Bye,
Mani. S ( mani_sound@satyam.net.in )
PS: in case you didnt know, Diwali is the festival of lights celebrated in India!!!

November 5th, 1999, 10:14 AM
It worked. Thank you!!!!