Hi All,
I've recorded a macro to copy a sheet and save it as a new file, with a few modifications (copies values over a pivot table, formats a few cells). The macro works well, when it works. About half the time, it just crashes excel, with no error message or anything. When it works, it works very quickly.
Is there something in the macro that tends to crash Excel, or is generally higher risk?
I've recorded a macro to copy a sheet and save it as a new file, with a few modifications (copies values over a pivot table, formats a few cells). The macro works well, when it works. About half the time, it just crashes excel, with no error message or anything. When it works, it works very quickly.
Is there something in the macro that tends to crash Excel, or is generally higher risk?
Rich (BB code):
Sub Export_Verification()'
' Export_Verification Macro
'
Application.ScreenUpdating = False
Sheets("Criteria Verification").Select
Sheets("Criteria Verification").Copy
ActiveWorkbook.BreakLink Name:= _
"Pathreplacedforprivacy" _
, Type:=xlExcelLinks
Range("L10:N25").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("M10").Select
Selection.Font.Bold = True
Range("L12").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
Selection.End(xlDown).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
Range("M25").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.Style = "Percent"
Selection.NumberFormat = "0.0%"
Range("N25").Select
Range(Selection, Selection.End(xlUp)).Select
Selection.Style = "Comma"
Selection.NumberFormat = "_(* #,##0.0_);_(* (#,##0.0);_(* ""-""??_);_(@_)"
Selection.NumberFormat = "_(* #,##0_ );_(* (#,##0);_(* ""-""??_);_(@_)"
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.Delete
Range("l1:n2").Select
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Range("a1").Select
ActiveWorkbook.SaveAs Filename:= _
Range("m1") & "" & Range("m2"), _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.ScreenUpdating = True
End Sub