Dibbley247
02-07-2013, 07:34 AM
I'm getting an error when testing saying "End without if"
Since I put a yes/no message box in.
Part of my code below:
Sub CleardownSheets()
Dim Response As Integer
Response = MsgBox(prompt:="This will clear the sheet for a new week, are you sure?", Buttons:=vbYesNo)
If Response = vbYes Then
'Will now clear ranges if YES was selected
Const PATH As String = "\\calfp03\Lynher Bakery\1AAMan Hours\current week\2013 - A1\1A WK"
With ActiveWorkbook
.SaveCopyAs Filename:=PATH & .Sheets("Reset Sheet").Range("A1").Value & ".xls"
Application.ScreenUpdating = False
' Will clear all sheets in workbook
Sheets("Sat Night (3)").Select
Range("B5,D5:K5,O5:P5,B7,D7:K7,O7:P7,B9,D9:K9,O9:P9,B11,D11:K11,O11:P11,D13:K13,O1 3:P13").Select
Selection.ClearContents
Application.ScreenUpdating = True
ActiveWorkbook.Save
Else
' The no button was selected.
MsgBox "Action Was Cancelled"
End If
End With
End Sub
Thanks
Since I put a yes/no message box in.
Part of my code below:
Sub CleardownSheets()
Dim Response As Integer
Response = MsgBox(prompt:="This will clear the sheet for a new week, are you sure?", Buttons:=vbYesNo)
If Response = vbYes Then
'Will now clear ranges if YES was selected
Const PATH As String = "\\calfp03\Lynher Bakery\1AAMan Hours\current week\2013 - A1\1A WK"
With ActiveWorkbook
.SaveCopyAs Filename:=PATH & .Sheets("Reset Sheet").Range("A1").Value & ".xls"
Application.ScreenUpdating = False
' Will clear all sheets in workbook
Sheets("Sat Night (3)").Select
Range("B5,D5:K5,O5:P5,B7,D7:K7,O7:P7,B9,D9:K9,O9:P9,B11,D11:K11,O11:P11,D13:K13,O1 3:P13").Select
Selection.ClearContents
Application.ScreenUpdating = True
ActiveWorkbook.Save
Else
' The no button was selected.
MsgBox "Action Was Cancelled"
End If
End With
End Sub
Thanks