View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Alok Alok is offline
external usenet poster
 
Posts: 318
Default How do I create a mandatory field in Excel

Say your mandatory field is Cell A1. Then put the following in the
Worksheet Change event of the sheet

Private Sub Worksheet_Change(ByVal Target As Range)
If (Intersect(Target.Cells(1), Range("A1")) Is Nothing) Then
If Trim(Range("A1").Text) = "" Then
MsgBox "Please enter a value in cell A1 before proceeding"
Application.EnableEvents = False
Target.Cells.Clear
Application.EnableEvents = True
End If
End If
End Sub


"RSP" wrote:

I would like to set a field in Excel to be mandatory. I want it to not go to
the next field unless data is entered. O