Solved

Change and Add Hyperlinks in Excel

Posted on 2016-10-02
6
58 Views
Last Modified: 2016-10-04
I have an Excel worksheet with a column needs to hyperlinked with PDF files in the same folder, the column text has the same PDF file name.
1) Is it possible to Hyperlink all without going one by one ?
2) Also there are some text in the sheet already Hyperlinked and  needs to be changed ?
3) If the folder has been moved to other path is it going to work ?

Thanks
0
Comment
Question by:m_jundi
[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
6 Comments
 
LVL 10

Assisted Solution

by:Carlos Ijalba
Carlos Ijalba earned 50 total points
ID: 41825361
Hi m_jundi,

1)  you can writing a macro in vba that uses a table to update the addresses

2)  you cannot change that hyperlink with data>hyperlink>modify ?

3)  it is if you have used absolute paths, if you have used relative paths, you will have to change them and make them absolute, with this I mean:

Absolute: " \\SHARE\folder1\forlder2\document"
Relative: "..\..\document"

the absolute path will work on any PC with access to the share, the relative will only work when executed from the correct path.
0
 
LVL 8

Expert Comment

by:Koen
ID: 41825373
try following code:
Sub Macro3()
'
' Macro3 Macro
'

'
    Range("C2").Select
    Do While ActiveCell <> ""
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
        ActiveCell.Value
    ActiveCell.Offset(1, 0).Select
    Loop
End Sub

Open in new window


Where your URL's are in column 3.
It will overwrite any existing url's
0
 

Author Comment

by:m_jundi
ID: 41825914
Koen,
1) as Carlos Ijalba advised do we need to change it to absolute paths ?
2) We need to add PDF extensions as the example shown below
3 ) Also advise if there are things need to be changed in the Macro except the the range

Example :
Column "F" DATA
A (Hyperlinked to A.PDF)
B (Hyperlinked to B.PDF)
C (Hyperlinked to C.PDF)

Thanks
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 33

Expert Comment

by:Rob Henson
ID: 41825957
If you use the HYPERLINK function you can create a hyperlink within the cell with variable inputs.

Syntax is:

=HYPERLINK(Link_Location, Friendly Name)

The Link Location can be put together as a string from various inputs using text functions. The Friendly Name is what appears in the cell and can be also be a cell reference.

Thanks
Rob H
0
 
LVL 8

Accepted Solution

by:
Koen earned 450 total points
ID: 41827115
I've adjusted the code... you now have 3 lines reading Mylink = ... you should only use one depending on the location of the files you are trying to link... (comment or delete the others)

and to answer your questions, yes absolute paths is always better; ".pdf" is added in the code below; I've changed the column to F per your data model...
should run fine...

Sub Macro3()
'
' Macro3 Macro
'

'
    Range("F2").Select
    Do While ActiveCell <> ""
    MyLink = "C:\directory\" & ActiveCell.Value & ".pdf" 'if the file is on the local machine
    MyLink = "\\Server\Directory\" & ActiveCell.Value & ".pdf" 'if the file is on a share
    MyLink = "https://yoursharepoint.com/site/library/" & ActiveCell.Value & ".pdf" 'if the file is on a sharepoint
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:=MyLink
    ActiveCell.Offset(1, 0).Select
    Loop
End Sub

Open in new window

1
 

Author Closing Comment

by:m_jundi
ID: 41827561
Thanks Koen, Perfect
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 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