OK, here's one for you guys. How can you prevent a user from clearing a cell value with the spacebar? Is there a way to trap the event and throw an alert or simply disable the spacebar for that cell?
A SPACE character has been entered in the cell, just like any other character.
It is a VERY VERY BAD HABIT to use the SPACE bar to "clear" a cell. Excel, rightly so, thinks that there is DATA in that cell and treats it as such. Since no one can SEE the SPACE character, ther's all sorts of problems that this can cause, like printing extra BLANK PAGES, which, of course, do have SPACE DATA on them
The best way to avoid this pitfall, is to train users to use Excel properly. Programmin could be done, but I would not recommend programming to avoid this bad habbit. In some cases, a SPACE might be necessary in a cell.
If you just want to prevent users from being able to alter a cell (emptying data, replacing data with a space character or otherwise making changes), check out Tools > Protection > Protect Sheet.
If there are any cells that you want not protected, then select those cells and go to Format > Cells > Protection and uncheck Lockedbefore turning on sheet protection.
[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]
Help us help you. Please read FAQ181-2886 before posting.
You could capture the keypress and direct it to an empty function (or an alert box). I'm not sure how to do it in VB, but in the macro language, use [tt]=ON.KEY(" ","MyMacro")[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.