View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Excel 2003 + macro for validation

Hi,

Here I've sheet_Deactivate to call the code but there are several events you
could use. Note I've left the syntax in for 2 types of range

Private Sub Worksheet_Deactivate()
'For Each c In Range("A1:A10")
For Each c In Range("A1,C1,E1")
If IsEmpty(c) Then
MsgBox "You must fill in " & c.Address
Sheets("Sheet1").Activate 'Change to suit
Exit Sub
End If
Next

End Sub
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Neil Holden" wrote:

Hi i have a set up sheet which required cells i need the users to fill in, is
it possible that when the button is pressed it highlights all the empty cells
that needs filling in giving a message to the user to go back and fill in the
required fields?

Thanks.