Save over files.

T

THE_RAMONES

I'm using the code below to pull multiple sheets together then move the files
to old folder. Say I want to run the sames files I ran through the macro
eariler it won't work if its already located in the old file folder.

Please let me know if you need more info to answer this question. Thanks


Application.EnableEvents = False
Application.ScreenUpdating = False
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
PathOld =
"R:\Reports\PDP-Reporting\CUSTOMER_SERVICE\DAILY\Scorecard\DATA_FEED\CURRENT_STREAM_WellCare_PDP\OLD FILES\" 'Change as needed
Path =
"R:\Reports\PDP-Reporting\CUSTOMER_SERVICE\DAILY\Scorecard\DATA_FEED\CURRENT_STREAM_WellCare_PDP" ''Change as needed
FileName = Dir(Path & "\WellcarePDP_Interval*.csv", vbNormal)
Do Until FileName = ""
Set Wkb = Workbooks.Open(FileName:=Path & "\" & FileName)
For Each WS In Wkb.Worksheets
If Left(WS.Name, 20) = "WellcarePDP_Interval" Then
WS.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
End If
Next WS
Wkb.Close False
fso.MoveFile Path & "\" & FileName, PathOld
FileName = Dir()
Loop
Application.EnableEvents = True
Application.ScreenUpdating = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top