Thread: Mandatory cell
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Mandatory cell

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1" '<=== change to suit

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If .Offset(0, 1).Value = "" Then
MsgBox "Adjacent cell is empty"
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Jeff" wrote in message
...
Hi Max,

How about VBA language to check for this and pop-up box to indicate

missing
entry ?

Jeff...

"Max" wrote:

One way ..
In B2: =IF(LEN(A1)<0,"<< Complete A2 !!","")
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Jeff" wrote:
Hi,

I like to know how do I set up in excel to setup a field to be a

mandatory
field if the field beside it has data ?

For example: If A1 has data, A2 can not be a blank field and prompt

error
message.