Hyperlink to website containing wording from a cell

garbology

New Member
Joined
Mar 26, 2015
Messages
16
In column D I have a list of numbers "111112"
I would like to turn those numbers into hyperlinks I want to show the original number but the hyperlink website would be http://ph/l.aspx?d=. (cell number) I have tried using the
=hyperlink("://ph/l.aspx?d="&d2,d2)

but the website is not updating correctly.
Any help would be great, also if able to do it in vba so I wouldn't need a extra column would be even better
 

Yard

Well-known Member
Joined
Nov 5, 2008
Messages
1,929
Hi, if I put 111112 in D2, and then this into E2, it works...

=HYPERLINK("http://google.com/search?q="&D2,D2)

I don't know what your hyperlink is going to, by starting it with a colon looks unfamiliar to me (but I know very little about such networking topics!)

When you say "the website is not updating correctly" - what does that mean?
 

garbology

New Member
Joined
Mar 26, 2015
Messages
16
I can't use another column for a website. I need to use the same website with the addition of the cell data at the end. I really would like a macro to do this and leave the hyperlink in the original column D
 

Yard

Well-known Member
Joined
Nov 5, 2008
Messages
1,929
Hi, I don't understand what you mean - you can't use another column for a website? You want the hyperlink to exist in a cell, right?

edit: Ahhhhhh, you mean you have the values in cells, and you want to overwrite those values with the corresponding hyperlink?
 

Yard

Well-known Member
Joined
Nov 5, 2008
Messages
1,929
Try this:

(it assumes your worksheet is called Hyperlinks and that you want to start in D2 and keep going down until you find an empty cell)

VBA Code:
Sub CreateHyperlinks()

Dim shtLinks As Worksheet, rngCell As Range
Const strAddress As String = "http://ph/l.aspx?d="

Set shtLinks = Worksheets("Hyperlinks")
Set rngCell = shtLinks.Range("D2")

Do Until IsEmpty(rngCell.Value) = True

    shtLinks.Hyperlinks.Add Anchor:=rngCell, Address:=strAddress & rngCell.Value
    Set rngCell = rngCell.Offset(1, 0)
    
Loop

End Sub
 

garbology

New Member
Joined
Mar 26, 2015
Messages
16
Dear Yard
Thank you for your help. That is exactly what I was looking for and worked perfectly!
 

Yard

Well-known Member
Joined
Nov 5, 2008
Messages
1,929
It's a skill in itself to explain clearly what you actually want to happen ;)
 

garbology

New Member
Joined
Mar 26, 2015
Messages
16
Getting ideas out of ones head so some one can understand it is real troublesome at times
 

Forum statistics

Threads
1,085,693
Messages
5,385,220
Members
401,936
Latest member
stephenpoff

Some videos you may like

This Week's Hot Topics

Top