Solved

Convert Selected Cells into hyperlink using VBA

Posted on 2013-05-22
3
373 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now