View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Mandatory cell check before closure

Hi Simon

You can use the Counta function like this in the Thisworkbook module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Application.WorksheetFunction.CountA(Sheets("Sheet 1").Range("a1:a10")) < 10 Then
MsgBox "fill in all cells"
Cancel = True
End If
End Sub

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Simon" wrote in message ...
Is there a way to have mandatory cells that must be
contain data being checked before the document is close
and prompting the user to complete all mandatory cells.

Many Thanks,


Simon