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,082,229
Messages
5,363,857
Members
400,767
Latest member
pksahu04

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top