PDA

View Full Version : required fields based on IF statement



dancingbear
07-23-2008, 01:21 PM
First off, I must say that I'm a complete newb to vba.
I'm using Excel 2003.
I am trying to accomplish the following...
I have a spreadsheet that is used as a form to gather data (not an actual Form, just data in cells). Row 1 has "headers": Name, Purchasing country, end user, lamp system, etc. Starting in Row 2, the users will type in the data.

I want to make some fields mandatory. The number of rows will vary. If the user enters data in column A, they must be forced to complete columns E - O also. I've been googling all day trying to make this work, but have had no luck.

:banghead:

Any insight or help would be very appreciated!!!

RonMcK
07-23-2008, 09:09 PM
Dancingbear, welcome to VBA Express. You've picked a good place to come for help and to learn about Excel worksheets and VBA.

Please post a worksheet** with the headings and sample data (not real client data but something approximating the relationships in the real data) showing the different possible combinations that you want the worksheet to handle. Show any formulas that you want to use, etc.

All of this will allow one or another of us to help you and point you to creating the worksheet/workbook you need.

** use Manage Attachments button to attach the worksheet to your reply.

Cheers!

dancingbear
07-24-2008, 06:08 AM
I've attached the workbook containing the headings & sample data.
Row 1 are the headings
Row 2 is a sample that has all the fields filled in.
Row 3 is a sample that has only the required fields filled in.
Row 4 is a sample that is missing all required fields.

The required fields are A, and E through O (E:O)
If they enter data in Column A, they must also complete E:O
The number of rows will vary.

As far as a formula goes, my train of thought was something like:
IF Column A <> " ", then verify that fields E:O are not blank.

I don't want them to be able to save or print it if all the required fields are not completed.

I hope that is clear! Let me know if you have any questions. Thanks in advance for your help!