Solved

Convert Selected Cells into hyperlink using VBA

Posted on 2013-05-22
3
403 Views
Last Modified: 2013-05-23
Dear Experts:

For the currently selected cell(s) (may be just one cell selected or several) do the following running a macro:

Convert the currently selected cell(s) (Cells contain a network path such as C:\\myfolder\\etc.) ...
... into a hyperlink where the address and text to display is the same.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
0
Comment
Question by:AndreasHermle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
rspahitz earned 500 total points
ID: 39188231
Try this:

Sub ConvertToHyperlink()
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
        ActiveCell.Value, TextToDisplay:=ActiveCell.Value
End Sub

Open in new window


When you run it, it will make the current cell a hyperlink to the contents of the cell.
Obviously, it does not validate that the current cell is a valid path.
0
 

Author Closing Comment

by:AndreasHermle
ID: 39190973
Hi,

Great this did the trick. Thank you very much for it.

Regards, Andreas
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 39191233
Great!  Glad to help Andreas.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question