So I have a workbook in which I need to disable Close button through:
But now it is conflicting with the procedure used to save the changes:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = True
End Sub
But now it is conflicting with the procedure used to save the changes:
Code:
Sub saveas_city_m()
AllFilled = True
For Each cll In Range("B4:B6").Cells
If Not cll.Value > 0.1 Then
AllFilled = False
Exit For
End If
Next cll
If AllFilled Then
For Each cll In Range("D13:D17").Cells
If cll.Value > 0.1 Then
If Not cll.Offset(, 1) > 0.1 Then
AllFilled = False
Exit For
End If
End If
Next cll
End If
If AllFilled Then
ActiveWorkbook.SaveAs "C:\Users\K\Desktop\tryOuts\23\city m.xlsm", FileFormat:=52
MyFile = "C:\Users\K\Desktop\tryOuts\CITY M.xlsm"
Kill MyFile
Application.Quit
Else
MsgBox "Can not save. Complete Cell: " & cll.Offset(, 1).Address(False, False)
End If
End Sub