Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change and Add Hyperlinks in Excel

Posted on 2016-10-02
6
Medium Priority
?
62 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 200 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
Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

 
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 1800 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

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
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 will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

719 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