Can a macro create a hyperlink with unique cell information?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a macro that take the information in a cell and add it
to the end of a hyperlink. I need to repeat this function numerous times
with different cell information.

PLEASE HELP!!!
 
Look in Excel help at the worksheetFunction Hyperlink

You don't need a macro.
 
Tom,

I can not use a worksheet Function due to the fact the last 6 characters of
the hyperlink are contacted in that cell. I need to be able to leave the
cell contents alone and add the hyperlink with the last 6 characters added.

Desiree
 
Not sure what
last 6 characters of
the hyperlink are contacted in that cell.

means, but unless you need the hyperlink placed in the cell with the
information (rather than another cell that uses the information), then a
worksheetfunction can be used.

However, if you want a macro, turn on the macro recorder and add the
hyperlink manually.
Turn off the macro recorder and alter the code to construct the URL you want
and pass it as an argument to the hyperlink.ADD method that you recorded.

This is what i recorded:

ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
"http://www.msnbc.msn.com/id/6306132/", TextToDisplay:="A"


so lets say the cell contains 6306132

I would modify it to
ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell, Address:= _
"http://www.msnbc.msn.com/id/" & Activecell.Value & "/", _
TextToDisplay:=ActiveCell.Value

now I could add a loop to go through my cells selected

Sub AddLinks()
for each cell in Selection
cell.Activate
ActiveSheet.Hyperlinks.Add Anchor:=ActiveCell, Address:= _
"http://www.msnbc.msn.com/id/" & Activecell.Value & "/", _
TextToDisplay:=ActiveCell.Value
Next
End sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top