[Solved] VBA: Trying to write code to make sure cell is grea

  • Hi J,

    Have you tried using Data / Validation on the cell? You can specify text length, or numeric values, or specific item from a list and give your own custom error message.

    (it's on the Data menu).

    Post back if this doesn't give you what you need.


  • Hi Ralph:

    Thanks for the reply. I am setting up a spread sheet that will be used by several people, many very novice. I am concerned with data validation that because when the workbook is initially opened all the cells that I want to validate will be null and the error messages active. This would be very confusing to several users. I would rather have a message box with a clear error description and solution.

    Thanks again

  • JJacob, I think that data validation will work for you. You can customize the error messages and the error-messages will not appear when the spraedsheet is opened - only when a user changes specific cells.

    You would like an error message when a user leaves specific cells, but what if they never enter the cells? They could leave the cells as null and still close the file? Or are the cells pre-populated?

    The other approach would be to use VBA code. A Workbook_BeforeSave function could check for null cells before saving & give an error message.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!