ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel 2003 + macro for validation (https://www.excelbanter.com/excel-discussion-misc-queries/257946-excel-2003-macro-validation.html)

Neil Holden

Excel 2003 + macro for validation
 
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.

Mike H

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.



All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com