only allow the workbook to close if the figure in A1 is between 500 and 600:
Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim dProfit As Double
dProfit = ThisWorkbook.Worksheets(1).Range("A1").Value If dProfit < 500 Or dProfit > 600 Then
MsgBox "Profit must be in the range 500 to 600"
Cancel = True End If End Sub