VBA - code doesn't complete to save the workbook

wesbez

New Member
Joined
Oct 29, 2015
Messages
7
Hi All,

The below code stops after it has used the group function, it doesn't change formula's back to automatic and doesn't save the sheet in a new workbook.

Any ideas why?

Thanks,
Wes

Code:
Sub Copy()
    
    Dim FName           As String
    Dim FPath           As String
    Dim NewBook         As Workbook
    
    Application.Calculation = xlManual
    Worksheets("Model").Cells.Copy
    Worksheets("Store Feedback").Range("A1").Select
    Worksheets("Store Feedback").Paste
    
    With Range("A1:AV20000")
        .Cells.Copy
        .Cells.PasteSpecial xlPasteValues
        .Cells(1).Select
    End With
    Application.CutCopyMode = False
    With Range("A1:AV20000")
        .Value = .Value
    End With
    Range("1:7").ClearContents
    Range("J:J,M:M,U:V,AH:AT,AY:BF").ClearContents
    ActiveSheet.Outline.ShowLevels RowLevels:=1, ColumnLevels:=1
    
    Application.Calculation = xlAutomatic
    
    FPath = "X:\WDFE\Supply Chain\2 Beauty Category Folder\Store MDQ Review\2018\Store Feedback"
    FName = Sheets("Summary").Range("STORE_NAME") & Format(Date, "dd-mm-yy") & ".xlsx"
 
    Set NewBook = Workbooks.Add
 
    ThisWorkbook.Sheets("Store Feedback").Copy Before:=NewBook.Sheets(1)
 
    If Dir(FPath & "\" & FName) <> "" Then
        MsgBox "File " & FPath & "\" & FName & " already exists"
    Else
        NewBook.SaveAs Filename:=FPath & "\" & FName
    End If
    
End Sub
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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