Mangesh wrote...
....
Then for the save event you can use something like:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
If IsEmpty(Sheet2.Range("A1")) Then
MsgBox "Cell A1 is empty"
Exit Sub
End If
If IsEmpty(Sheet2.Range("A10")) Then
MsgBox "Cell A10 is empty"
Exit Sub
End If
End Sub
....
Several caveats. First, this requires macros be enabled. Since it's
very easy to disable macros, your approach on it's own is unreliable.
Second, if we assume the managers in question are lazy but perversely
clever SOBs (not an unreasonable assumption), what's to prevent them
from entering a single space character in each cell they couldn't be
bothered to enter previously but are now forced to navigate to?
The first step in any macro-based security needs to be *FORCING* users
to enable macros. The easiest way to do that is to use do-nothing udfs
like
Function udf(): End Function
then include udf() calls in *EVERY* formula in the workbook. If macros
are disabled, udfs return #NAME? errors, so all formulas would return
errors. You could & should go further and check whether this udf
returns #NAME?, and if so display error messages informing the
user-managers how they're screwing up (and it doesn't hurt to tell them
that a record of repeated screw-ups is being maintained - managers
understand fear, er, motivation). A formula like
=IF(COUNT(1/(ERROR.TYPE(udf())=5)),"You screwed up again!","")
or
=IF(COUNT(1/(ERROR.TYPE(udf())=5)),"Are you really so incompetent that
you can't enable macros on your own? The support number is
###-###-####.","")
Once you've gotten the attention of these user-managers, they'll enable
macros. At that point, your event handlers need to perform real data
validation, checking not that key entry cells are nonblank, but that
their entries match acceptable patterns. That's harder, and usually
requires some form of text pattern matching.