VBA code for finding matching files and add hyperlink

papplaszlodaniel

New Member
Joined
May 13, 2014
Messages
10
Hi there,


I have the list of file names in Excel (MS Excel 2013) without extensions (such as ".pdf").
I would like to have a macro which if finds a file with a matching file name (in a given folder), it hyperlinks it to the matching Excel cell.


E.g.:

In Excel, column B contains the following list:

File names
B2
B3
B4
B5
B6

<tbody>
</tbody>

In a folder there are the following files:

B2.pdf
B3.pdf
D444.pdf
B5.pdf
B6.pdf

So after running the macro, it links the matching ones to the relevant cells (and does nothing when it doesn't find exact matches):

File names
B2
B3
B4
B5
B6

<tbody>
</tbody>


It would be the best if when running the macro, a window would pop up to select the folder where the macro should check the files.
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,215,580
Messages
6,125,652
Members
449,245
Latest member
PatrickL

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