I need to force the user to enter data in every cell before clicking the "Next" button I have put in. Is this possible without using a VB form? This message was edited by Amy DeLuca on 2002-10-19 14:22
Yes, this is easy to do. Here is an example. This code added to your button's Click event will check to make sure all the cells in E1:E6, B1:B6, and G4 contain data. It selects the first empty cell it finds and displays an error message. While this code just checks to make sure there are no empty cells, it would also be easy to go further and do checking on the inputs to make sure they are valid entries.
Private Sub NextButton_Click()
'The user must enter data into all the defined cells before
'clicking this button.
Dim Cel As Range
For Each Cel In [b1:b6, e1:e6, h4]
If IsEmpty(Cel) Then
MsgBox "Missing data", vbExclamation, "Can't proceed without all data"