View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Adam Harding Adam Harding is offline
external usenet poster
 
Posts: 9
Default beforesave and beforeclose

Am looking to disable saving and closing subject to field M2 = 0 i am trying

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = (Me.Sheets(1).Cells(1, 1) = _
Me.Sheets(2).Cells(1, 1))
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Cancel = (Me.Sheets(1).Cells(1, 1) = _
Me.Sheets(2).Cells(1, 1))
End Sub

But not knnowing VB that well am running into errors. My worksheet is called
Detailed_Cost_Sheet and is sheet 4. so what should my VB say?

Cheers