Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Macro to create hyperlink

I have cells in an Excel 2003 spreadsheet that contains the path to a file. I
would like to create a macro that takes the content of an active cell (that
has a path to a file) and convert it to a hypelink to that file.
Any help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Macro to create hyperlink

Hello,

this works on the activecell

Dim MyHyper As String
MyHyper = ActiveCell.Value
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
MyHyper, TextToDisplay:=MyHyper

or if you wanted to, you could specify the cell by

Dim MyHyper As String
range("A1").select
MyHyper = ActiveCell.Value
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
MyHyper, TextToDisplay:=MyHyper

hope that helps.
--
Kevin Smith :o)


"JoeP" wrote:

I have cells in an Excel 2003 spreadsheet that contains the path to a file. I
would like to create a macro that takes the content of an active cell (that
has a path to a file) and convert it to a hypelink to that file.
Any help would be appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro to create hyperlink

Hi,

The 'macro' to do this is a one-liner. If you have lots of these then its
posible to loop through them

Sub addlinks()
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:=Selection.Text
End Sub


Mike

"JoeP" wrote:

I have cells in an Excel 2003 spreadsheet that contains the path to a file. I
would like to create a macro that takes the content of an active cell (that
has a path to a file) and convert it to a hypelink to that file.
Any help would be appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to create hyperlink


This is for every cell in a range but you can adapt it!


Code:
--------------------
Dim Rng As Range, MyCell As Range
Set Rng = Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
For Each MyCell In Rng
If MyCell < "" Then
MyCell.Hyperlinks.Add Anchor:=Range(MyCell.Address), Address:=MyCell.Text, TextToDisplay:=MyCell.Text
End If
Next MyCell
--------------------


JoeP;478050 Wrote:
I have cells in an Excel 2003 spreadsheet that contains the path to a
file. I
would like to create a macro that takes the content of an active cell
(that
has a path to a file) and convert it to a hypelink to that file.
Any help would be appreciated.



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=131871

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP to program a macro to create a hyperlink Nemo69 Excel Programming 0 February 20th 09 12:51 PM
Create a Hyperlink as part of a macro Nahraine New Users to Excel 1 March 7th 07 04:37 PM
how can I create a save file hyperlink or macro in a workbook? Jon Peltier Excel Programming 0 December 29th 06 06:33 PM
Macro To Create Hyperlink from html text Ketan Patel Excel Programming 1 September 6th 05 05:03 PM
Create a HYPERLINK with a macro? bobgerman[_3_] Excel Programming 2 December 22nd 03 06:41 PM


All times are GMT +1. The time now is 03:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"