try it
Sub Demo() Dim lngCount As Long Dim cl As Range Set cl = ActiveCell ' Open the file dialog With Application.FileDialog(msoFileDialogOpen) .AllowMultiSelect = True .Show ' Display paths of each file selected For lngCount = 1 To .SelectedItems.Count ' Add Hyperlinks cl.Worksheet.Hyperlinks.Add _ Anchor:=cl, Address:=.SelectedItems(lngCount), _ TextToDisplay:=.SelectedItems(lngCount) ' Add file name 'cl.Offset(0, 1) = _ ' Mid(.SelectedItems(lngCount), InStrRev(.SelectedItems(lngCount), "\") + 1) ' Add file as formula cl.Offset(0, 1).FormulaR1C1 = _ "=TRIM(RIGHT(SUBSTITUTE(RC[-1],""\"",REPT("" "",99)),99))" Set cl = cl.Offset(1, 0) Next lngCount End With End Sub
source share