Solved

EXCEL: HYPERLINK WITH DYNAMIC XLS FILE

Posted on 2014-11-28
8
370 Views
Last Modified: 2014-12-26
Hello,
I have a Excel file with odbc connexion.
for the sample I need the following:

col A - data
col B - URL
col C - data

is there a way to make automatically col B hyperlink link ?
I know how to do it with normal xls spreed but not with dynamic ...
0
Comment
Question by:bruno_boccara
8 Comments
 
LVL 18

Expert Comment

by:SimonAdept
ID: 40470217
Would it be acceptable to put a formula column to the right of the results columns?
=HYPERLINK(B1)
or make the dynamic columns hidden and create 3 columns to the right so you have
=A1
=HYPERLINK(B1)
=C1
0
 
LVL 21

Expert Comment

by:Tapan Pattanaik
ID: 40470219
Hi bruno_boccara,

If you don't want to create a macro and as long as you don't mind an additional column, then just create a new column alongside your column of URLs. (here, col B)

In the new column type in the formula =HYPERLINK(B). Then copy the formula down the rest of the  entries.
0
 

Author Comment

by:bruno_boccara
ID: 40470247
I do not want to add manually formula.

If I have to create a macro , it is also ok with me. what will be the macro ?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 21

Expert Comment

by:Tapan Pattanaik
ID: 40470285
Public Sub Convert_To_Hyperlinks()
    Dim Cell As Range
    For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
        If Cell <> "" Then
            ActiveSheet.Hyperlinks.Add Cell, Cell.Value
        End If
    Next
End Sub
0
 
LVL 5

Accepted Solution

by:
Hakan Yılmaz earned 500 total points
ID: 40472199
You may try this.

Sub MakeRangeHyper(ByRef LinkRange As Range)
      Dim iterCell As Range
      For Each iterCell In Intersect(LinkRange, LinkRange.Worksheet.UsedRange)
            LinkRange.Worksheet.Hyperlinks.Add iterCell, iterCell.Value2
      Next iterCell
End Sub

Open in new window


You should call this sub with a reference to cells that have link addresses. Example:

Sub StartHyper()
    MakeRangeHyper ActiveWorkbook.ActiveSheet.UsedRange
    MakeRangeHyper ActiveWorkbook.ActiveSheet.Range("B4:B5")
    MakeRangeHyper ThisWorkbook.Worksheets("Sheet1").Range("B4:B5")
End Sub

Open in new window

0
 

Author Comment

by:bruno_boccara
ID: 40512706
Please let the question open.
did not have time to check the solution.
But it is very important for me.

Regards.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 40518270
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

747 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

12 Experts available now in Live!

Get 1:1 Help Now