check input in cells

  • Thread starter Pierre via OfficeKB.com
  • Start date
P

Pierre via OfficeKB.com

Hi expert,

I have an application that runs in a userform.
The user can click a button and then returns to Excel where he can put in up
to 1000 records of data (employees of a copany with their data, date of birth,
salary etc.)

How can i make sure that the user fills out all the nescessary cells ?
If the user puts in a line i need to check if the cells in column B,C,E,F and
G are filled in.
if one of the cells is not filled in, the application gives an error message
and is closed without saving.

I would rather have the program givean error message stating that the data
that is filled in the cells is not complete.

Is there a way to check this ?
Thanks,
Pierre
 
G

Guest

Let's say you are dealing with row i. Try something link:


If IsEmpty(Cells(i, 2)) Or IsEmpty(Cells(i, 3)) Or IsEmpty(Cells(i, 5)) Or
IsEmpty(Cells(i, 6)) Or IsEmpty(Cells(i, 7)) Then
MsgBox ("Please complete input")
End If
End Sub

Where the if is all in one line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top