If 1st file is not found then look for 2nd file or 3rd file opened....!

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi,

If 1st file ("For Pedie(1).xls") is not found then look for 2nd file ("For Pedie(2).xls") if not found then look for 3rd file ("For Pedie(3).xls"). If file is found anytime then stop looking for the other files and do what my code has to do. Below is the code that looks for single file and if there is no file then gives me error....
P.S: Anyone of these three files will be open when this code is running from book "try.xlsm"

Thanks to everyone for helping!


Code:
Sub try2()
' the bold line below has nothing to do with my code but i thought this line stoped the error i was receiving earlier:biggrin:
[B]Dim wb As Workbook, myfile As String[/B]
Workbooks("For Pedie(1).xls").Activate
    Range("A1").Copy
    Windows("Try.xlsm").Activate
    Cells(1).Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
End Sub
 
Wow..you guys are amazing...! Charity;) that so great!
And Peter I usually find you here all the time...I guess you have very less work @ work:biggrin: kidding!


Anyways..thanks for always being there to help! I hope & pray you guys get blessed abundantly for all the tireless efforts you put in to do all these charity works...this helps a lot esp. ME and I'm sure has hellped others too in a million ways!

Thanks again
 
Upvote 0

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