MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Customizing error messages


Posted by James on August 20, 2001 4:39 AM

I have protected a selection of cells in a worksheet. Therefore when I try to enter anything in to any of these cells, I get the standard error message about "The cell or chart you have tried to change is protected. ...." Is there any way to customize or change this error message to something of my choosing, using VBA?


Posted by Alix on August 20, 2001 6:18 AM

Hi James

Not sure about doing this in VB, but there is a way of doing it with conditional formatting.

Highlight your range

Go to : Data | Validation

choose 'Custom' from the drop-down at 'Allow'
Enter the formula:

=""

You can then set your own message on the Error Alert tab.

When a user enters a value in the range, the error alert will appear when they hit enter/tab and the cell will revert to its original value

HTH
Alix