Sub CreateList_CD()'
' CreateList_CD Macro
'
'
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.EnableEvents = False
Sheets("CD").Copy
Columns("E:E").Cut
Columns("C:C").Insert Shift:=xlToRight ' 1004 error here
Columns("E:E").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("F:F").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Columns("I:I").Select
Selection.Cut
Columns("E:E").Select
Selection.Insert Shift:=xlToRight
Range("C2:D2").Select
Range(Selection, Selection.End(xlDown)).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent5
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
Range("D1").Select
ActiveCell.FormulaR1C1 = "Order"
Range("G1").Select
ActiveCell.FormulaR1C1 = "Order"
Columns("D:D").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Range("A1").Select
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.EnableEvents = True
Dim file_name As Variant
Dim FName As String
FName = "CD List"
' Get the file name.
file_name = Application.GetSaveAsFilename(FName, _
FileFilter:="Excel Files,*.xlsx,All Files,*.*", _
Title:="Save As File Name")
' See if the user canceled.
If file_name = False Then Exit Sub
' Save the file with the new name.
If LCase$(Right$(file_name, 4)) <> ".xlsx" Then
file_name = file_name
End If
ActiveWorkbook.SaveAs FileName:=file_name
End Sub