ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   prevent blank cell (https://www.excelbanter.com/excel-discussion-misc-queries/19331-prevent-blank-cell.html)

Ken Stratford

prevent blank cell
 
How do I prevent users of my workbook from making a cell blank? I want them
to be able to edit it so have left it unprotected but I donot want them to
be able to leave it blank. It looks as if the Data Validation command should
do it, but I can't get it to work.

Jerry W. Lewis

Your repeat post appears as a reply to the thread in my browser. As a
result, I almost didn't read your post on the assumption that your
question had already been answered. I suspect many others did ignore
your post for the same reason.

Assuming that you know how to set up the validation condition (uncheck
"Ignore blank", set up a "Custom" validation, such as =ISNUMBER(A1)
where A1 is the cell to validate, etc.) then I presume that you are
hitting a known weakness of Data Validation, where deleting data from
the cell (without replacing with anything new) leaves the cell empty, so
the Data Validation event does not fire (presumably the faulty logic was
that there is no data to validate ...). You can roll your own patch in
VBA along the lines of
http://groups-beta.google.com/group/...945c7bccd60819

Jerry

Ken Stratford wrote:

How do I prevent users of my workbook from making a cell blank? I want them
to be able to edit it so have left it unprotected but I donot want them to
be able to leave it blank. It looks as if the Data Validation command should
do it, but I can't get it to work.



Dave Peterson

I like to use an adjacent column and put a formula like:

=if(trim(a1)<"","","<-- Don't leave blank")

I bold it in big red letters.



Ken Stratford wrote:

How do I prevent users of my workbook from making a cell blank? I want them
to be able to edit it so have left it unprotected but I donot want them to
be able to leave it blank. It looks as if the Data Validation command should
do it, but I can't get it to work.


--

Dave Peterson

Ken Stratford



"Jerry W. Lewis" wrote:

Your repeat post appears as a reply to the thread in my browser. As a
result, I almost didn't read your post on the assumption that your
question had already been answered. I suspect many others did ignore
your post for the same reason.

Assuming that you know how to set up the validation condition (uncheck
"Ignore blank", set up a "Custom" validation, such as =ISNUMBER(A1)
where A1 is the cell to validate, etc.) then I presume that you are
hitting a known weakness of Data Validation, where deleting data from
the cell (without replacing with anything new) leaves the cell empty, so
the Data Validation event does not fire (presumably the faulty logic was
that there is no data to validate ...). You can roll your own patch in
VBA along the lines of
http://groups-beta.google.com/group/...945c7bccd60819

Jerry

Ken Stratford wrote:

How do I prevent users of my workbook from making a cell blank? I want them
to be able to edit it so have left it unprotected but I donot want them to
be able to leave it blank. It looks as if the Data Validation command should
do it, but I can't get it to work.


Thanks - a good solution - I knew there had to be a way! Ken


Ken Stratford



"Dave Peterson" wrote:

I like to use an adjacent column and put a formula like:

=if(trim(a1)<"","","<-- Don't leave blank")

I bold it in big red letters.



Ken Stratford wrote:

How do I prevent users of my workbook from making a cell blank? I want them
to be able to edit it so have left it unprotected but I donot want them to
be able to leave it blank. It looks as if the Data Validation command should
do it, but I can't get it to work.


--

Dave Peterson
Thanks Dave - that's a useful way round it..

Ken

Jerry W. Lewis

Ken Stratford wrote:
....

Thanks - a good solution - I knew there had to be a way! Ken



You're welcome, glad it helped.

Jerry



All times are GMT +1. The time now is 09:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com