Code to open a file based on Cell Data, and a WildCard

stmur

New Member
Joined
Feb 19, 2013
Messages
10
Good Day!

:confused:Cant seem to get the head around this one:
trying to open an excel file based on cell value, and also has some unknown numbers/letters at the end of it..

For instance, I know that the file name starts with 4 bracketed numbers which are known. ie. (6345)
then after the bracket, there is a customer order number which could be anything, and any length. so the result is: (6345)***********

what i need to do is use the 4 known numbers (which are variable, but will be in a cell) and open the file from a known file path

yell out if i need to give more info!

thanks in advance
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi stmur,

Here's a thread that has some code in Post #4 that could be used as a starting point for a macro that does what you describe.
http://www.mrexcel.com/forum/excel-...-code-copy-file-based-keywords-file-name.html

In that example the user was copying all files with names that contained keywords from a list.
You could modify this to use just one keyword and to open the file(s) instead of copying it.

If it's possible that you'll have more than one match, you'll need to decide what to do in that case.

Just ask if you want some help adapting this.
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

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