ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can a macro create a hyperlink with unique cell information? (https://www.excelbanter.com/excel-programming/314411-can-macro-create-hyperlink-unique-cell-information.html)

Desiree

Can a macro create a hyperlink with unique cell information?
 
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!!!

Tom Ogilvy

Can a macro create a hyperlink with unique cell information?
 
Look in Excel help at the worksheetFunction Hyperlink

You don't need a macro.

--
Regards,
Tom Ogilvy

"Desiree" wrote in message
...
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!!!




Desiree

Can a macro create a hyperlink with unique cell information?
 
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

"Tom Ogilvy" wrote:

Look in Excel help at the worksheetFunction Hyperlink

You don't need a macro.

--
Regards,
Tom Ogilvy

"Desiree" wrote in message
...
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!!!





Tom Ogilvy

Can a macro create a hyperlink with unique cell information?
 
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

--
Regards,
Tom Ogilvy


"Desiree" wrote in message
...
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

"Tom Ogilvy" wrote:

Look in Excel help at the worksheetFunction Hyperlink

You don't need a macro.

--
Regards,
Tom Ogilvy

"Desiree" wrote in message
...
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!!!








All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com