Hi all,
I'm having trouble debugging this macro that asks the user if they're sure about saving, saves the file as a specific name, and then deletes entries in the workbook. The error comes up in the "ThisFile" line.
Private Sub CommandButton1_Click()
If MsgBox("Are you sure you want to save and open a new chart? This chart will disappear and a new chart will be created.", vbYesNo) = vbNo Then Exit Sub
ThisFile = Range("Data!X1").Value & "." & Range("Data!Z1").Value & "." & Range("Data!Y1").Value & "." & Format(Date, "mmdd") & ".xlsm"
ActiveWorkbook.SaveAs Filename:="C:\My Documents\SPC\" & ThisFile
Range("A3").Select
ActiveCell.FormulaR1C1 = "1"
Range("B4:AG12").Select
Selection.ClearContents
Range("B3:N3").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=12
Range("B30:AG30").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-24
End Sub
Bookmarks