Not allowing special characters in a cell

T

TinaF

I want to do either "conditional formatting" or "data validation", I
think, so that users will not be able to enter special characters in a
particular cell (/ * \ @, etc).

There is a macro that saves the spreadsheet using the data in this
cell as part of the file name. If they use certain special characters
(such as slashes) it causes an error when they try and run the "file
save" macro.

However, I don't see how to bar the entering of specific characters
using conditional formatting or data validation. How would I do this?
 
G

Guest

Perhaps use a worksheet event which checks the cell when it is entered and
"reports" on any errors.
 
G

Guest

In the macro that uses this cell for part of the filename you could strip the
special characters before using the information (or substitute acceptable
characters).
Will
 
G

Guest

To use data validation for this, make sure the cell you want is the active
cell. Select
Data >> Validation. On the Settings tab, select Custom from the Allow
combobox. Then, in the Formula box, you can enter something like:

<>"/" And <> "\" And <> "*" And <> "@" And <> "&"

If the user types any of the specified characters in the cell, an error
message (which you can customize) will be displayed when he/she presses Enter.

Hope this helps,

Hutch
 

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