link it! hyperlink with variable input cells

tass

New Member
Joined
Feb 9, 2010
Messages
11
Hi most appreciate expert,

I would like to insert a hyperlink in the following code:

Code:
Sub metadata1()
    Dim wsOut As Worksheet
    Dim zOut As Long
    Dim xOut As Long
    Dim ws As Worksheet, WB As Workbook
    Dim varFS
    Dim i
   
    Set wsOut = ThisWorkbook.Worksheets(1)
    wsOut.Cells.Clear ' <--Achtung ;-)
    zOut = 1
    
   
    Application.ScreenUpdating = False
   
    Set varFS = Application.FileSearch
    With varFS
        .LookIn = "C:\Temp\
        .Filename = "*.xls"
        .SearchSubFolders = True
        If .Execute > 0 Then
            For i = 1 To .FoundFiles.Count
                Set WB = Workbooks.Open(varFS.FoundFiles(i), UpdateLinks:=0)
                zOut = zOut + 1
                wsOut.Cells(zOut, 1) = WB.Name
                wsOut.Cells(zOut, 2) = WB.Path & "\" & WB.Name
                wsOut.Cells(zOut, 3).Formula = Hyperlink(zOut, 2; zOut, 1) '<- this was my poor trial to get it done by myself (does not work)
                xOut = 4
                For Each ws In WB.Worksheets
                    wsOut.Cells(zOut, xOut) = "WS " & ws.Index & ":" & ws.Name
                    xOut = xOut + 1
                    wsOut.Cells(zOut, xOut) = Cells(1, 1) & " - " & Cells(2, 1)
                    xOut = xOut + 1
                    'usw
                Next
                WB.Close savechanges:=False
            Next i
        End If
    End With 'varFS
    Application.ScreenUpdating = True
End Sub
Could someone replace my useless line by one that works, please?! Could not figure out how to do it. Actually it is just to put in the 3rd column the hyperlink which takes the path from the 2nd and the name for the link from the first column of the same line. I don't want a direct link in the 2nd column as the file will be copied to several computers, all with a slightly different tree and by applying the replace function on column 2 everyone can adjust the hyperlinks later alone.
Using Office 2002.

Would be grateful for help.
Thx,
tass.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
no one any idea? Is that more difficult than it appears to be?
Still hoping for help.
thx, tass.
 
Upvote 0
thx meldoc.

already knew this post but it does not apply for me. My problems is to get the variable input cells working, i.e. it always takes the values of the two cells which were filled in right before as variables. Probably easy I just don't know how to do it...
 
Upvote 0
that's all I know about Hyperlinks, but the line in question errors, in my editor because of the semicolon, used as a separator.

wsOut.Cells(zOut, 3).Formula = Hyperlink(zOut, 2; zOut, 1)
 
Upvote 0
yes, the semicolon is a problem, but I already tried several other ways how to put it but it did not work.

Is there no experienced guy out there who knows how to get that done properly, please?
 
Upvote 0

Forum statistics

Threads
1,224,566
Messages
6,179,553
Members
452,928
Latest member
101blockchains

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top