Excel Data Validation

  • Thread starter Thread starter Sue
  • Start date Start date
S

Sue

Hi there

I wish to prevent certain values (eg: the words "Expenses", or "Exps")
from being entered into a cell...they can enter any other
description/words they like (up to say, 40 characters), I just don't
want them to be able to enter either of those mentioned above....how
do I do it? VBA?

The data validation function is just not cutting the mustard, but it
may be I'm overlooking something simple...?

thanks in advance - really appreciate any help
Sue
 
Sue

You can use Data Validation. Choose the Custom option from the dropdown
and use a formula like this

=AND(A1<>"Expenses",A1<>"Exps")

assuming you're setting it up for A1. The AND function can take up to
thirty arguments if you need to add words later. Another option is a
formula like this

=LEFT(A1,3)<>"Exp"

although that will flag a lot of words that you many not want to flag.
 
The sheet "OnChange" event fires whenever a cell value is changed. Some VBA
in there would allow you to block content.
If you need more info please reply to the group

--
If I've mis-understood the question please tell me.

HTH

ijb

Remove nospam from my e-mail address to talk direct

Not MCSD, MVP, TLA, P&P, PCMCIA, etc just trying to help
 

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

Back
Top