Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default display text from a link

Hi all,

trough this forum I resolve the issue how to make a link from text lines

with a macro.

Example: the data loaded from a text file was

COLUMN A COLUMN B
www.microsoft.com link to microsoft
www.playboy.com nice pictures
www.google.com search engine

with the following macro the text in column A was set to link so
klicking on it will open the browser and open the displayed addres.
First selecting the wanted cells.
---------------------------------------
Sub AddHperLinks()
Dim cl As Range

For Each cl In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=c1, Address:=CStr("http://" &
cl.Value)

Next cl
---------------------------------------

What I need now is that the the text on column B changed in a link so
that klickin on it will bring me to the address as mentioned in column A
.. I intended t o delete column A after everithing is changed.
Using TextToDisplay may be a solution but I don't know how to place it
and make it working when loading the above example.

Appreciate any help !!

Best regards,

Ronald.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default display text from a link

I think I'd hide columns A and B and use a worksheet formula in column A:

=HYPERLINK("http://"&A1,B1)

But this may help. I selected my range in column A and did the work there--I'd
want to delete column B when I was done.

Option Explicit
Sub AddHperLinks()
Dim cl As Range
For Each cl In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=cl, _
Address:="http://" & cl.Value, _
TextToDisplay:=cl.Offset(0, 1).Value
Next cl
End Sub

And watch out. Sometimes you type C1 (c-one) and sometimes (cl c-ell). They're
different!

"Ronald (Gmail)" wrote:

Hi all,

trough this forum I resolve the issue how to make a link from text lines

with a macro.

Example: the data loaded from a text file was

COLUMN A COLUMN B
www.microsoft.com link to microsoft
www.playboy.com nice pictures
www.google.com search engine

with the following macro the text in column A was set to link so
klicking on it will open the browser and open the displayed addres.
First selecting the wanted cells.
---------------------------------------
Sub AddHperLinks()
Dim cl As Range

For Each cl In Selection.Cells
ActiveSheet.Hyperlinks.Add Anchor:=c1, Address:=CStr("http://" &
cl.Value)

Next cl
---------------------------------------

What I need now is that the the text on column B changed in a link so
that klickin on it will bring me to the address as mentioned in column A
. I intended t o delete column A after everithing is changed.
Using TextToDisplay may be a solution but I don't know how to place it
and make it working when loading the above example.

Appreciate any help !!

Best regards,

Ronald.


--

Dave Peterson
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
Using TEXT and &TEXT - display numbers with commas, underline text Gary Excel Discussion (Misc queries) 3 May 5th 23 03:46 AM
Cells act as if they are linked-link does not display in entry bar NatalieGS Excel Discussion (Misc queries) 2 December 1st 09 05:31 PM
How to I format a cell to display the link Beverly Parker Excel Discussion (Misc queries) 1 February 10th 09 05:23 PM
can't display link as icon sgawler Excel Worksheet Functions 0 April 11th 08 04:56 PM
Display the complete URL instead of a link Susan Excel Discussion (Misc queries) 2 November 23rd 05 03:30 PM


All times are GMT +1. The time now is 01:08 PM.

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"