thedeadzeds
Active Member
- Joined
- Aug 16, 2011
- Messages
- 451
- Office Version
- 365
- Platform
- Windows
Hi Guys,
I have the below code which works great but is there a way to overwrite the files if they already exist
I have the below code which works great but is there a way to overwrite the files if they already exist
Code:
Sub Run()
Dim ws As Worksheet, newWb As Workbook
Application.ScreenUpdating = False
For Each ws In Sheets(Array("Bethan", "Hannah"))
ws.Copy
Set newWb = ActiveWorkbook
With newWb
.SaveAs Filename:="C:\Users\craig.jenkins\OneDrive - Mon Motors Ltd\Equal Allocation\" _
& ws.Name & xlsx
.Close (False)
End With
Next ws
Application.ScreenUpdating = True
End Sub