View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default Display error message if a cell is left blank

I meant of course In the Sheet2 module.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Sandy Mann" wrote in message
...
In the Sheet module paste in this code:

Private Sub Worksheet_Activate()
If Application.CountA(Sheets("Sheet1").Range("B5:B50" )) < 45 Then
MsgBox "You have left a required field empty"
Sheets("Sheet1").Activate
End If
End Sub

If you want the user to be able to porceed even with a blank in a cell
remove the

Sheets("Sheet1").Activate

line.


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Another Excel User" <Another Excel
wrote
in message ...
How do you get Excel to display an error message if a cell is left blank?

I have a workbook with multiple sheets and what I want to do is for Excel
do
to is look at a certain range and display an error message if a cell
within
the defined range is left blank. I want this message to appear when
someone
tries to advance to the next sheet.

For example: In Sheet 1 have a row of questions cells A5:A50 and a place
to
answer those questions B5:B50 and when I am finished with answering the
questions I have to click on the next sheet, but in case I forgot to
answer a
question (leaving one of the B cells empty) I would like Excel to display
an
error message that says something like "you have left a required field
empty,
are you sure you want to continue"

Thank you in advance for your help