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!
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