MACRO Error trying to Locating Files

nassr

New Member
Joined
Sep 8, 2006
Messages
11
I'm using the following code to create a macro that looks into various directories and files based on a specified list. The macro was working correctly yesterday, but now I keep getting an error message that says it cannot find the appropriate file (even though the file names are correct). Any ideas what I could do to fix?

Sub CreateGroupProcurementsFile()
' '
Application.ScreenUpdating = False

'create variable for user path and file
Dim MyPath
Dim MyFile

'Clear Old Data
GroupProcurement.Range("A7:T10000").Select
Selection.ClearContents

'start at first file
MACRO.Select
Range("A7").Select

'create loop for each file
Do Until ActiveCell = ""
Let MyPath = ActiveCell.Value
ActiveCell.Offset(0, 1).Range("A1").Select
Let MyFile = ActiveCell.Value
ChDir MyPath
Set wbOpen = Workbooks.Open(Filename:=MyFile, UpdateLinks:=0) 'This is the line that is continually getting caught up

'Copy and Paste Range file

Sheets("Plan").Select
Range("A51:T1200").Copy

Windows("GroupProcurements.xls").Activate
GroupProcurement.Select
Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 0).Select

Selection.PasteSpecial Paste:=xlPasteValues

wbOpen.Close

'move down to next file
MACRO.Select
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
'end of loop above

GroupProcurement.Select
Range("A1").Select

End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,214,827
Messages
6,121,812
Members
449,048
Latest member
greyangel23

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