View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sridhar Pentlavalli via OfficeKB.com Sridhar Pentlavalli via OfficeKB.com is offline
external usenet poster
 
Posts: 11
Default Hold closing the sheet...


Hi

I have to validate the data at the time of closing the sheet. If some errors are present in the data, I need to throw a message and I should not close the sheet.

I am using the following code to achieve it. Here the problem is I can throw an error message if the data is wrong but how to stop the work book from closing. I have to give a chanse to user to correct the data. How this can be achieved?

Private Sub Workbook_BeforeClose(Cancel As Boolean)

{ Validate the data }

If Error Msgbox ( " Error .... Correct the Data " )

End Sub

--
Message posted via http://www.officekb.com