Validating Excel Cells

  • Thread starter Thread starter B.M.Srinivasa
  • Start date Start date
B

B.M.Srinivasa

How to validate the Cells in MS Excel, so that when the
cells are blank the sheet should not save and should warn
for inserting charectors/numbers
 
one way:

Put something like this in the ThisWorkbook code module:

Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Application.CountA(Sheets(1).Range("A1,B2,C3")) <> 3 Then
Cancel = True
MsgBox "You must have entries in A1, B2, and C3 in Sheet1"
End If
End Sub



If you're not familiar with macros, see

http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
Back
Top