ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   clearcontents, worksheet_change, cell validation (https://www.excelbanter.com/excel-programming/321570-clearcontents-worksheet_change-cell-validation.html)

Jan

clearcontents, worksheet_change, cell validation
 
In a 2000 template I have a cell that has a data validation list. When the
value of this cell is changed, 2 other cells have to be cleared. This is
done by programming the worksheet_change event with a cell().clearcontents.
This is the problem: when you type a value from the list, the event fires
and the clearcontents does its work, however if you select a value from the
list the event also fires but the clearcontents doesn't work and doesn't give
an error

Tom Ogilvy

clearcontents, worksheet_change, cell validation
 
If the event fires and the code to clear the cells is in that event, then
the normal behavior is for the cells to be cleared in all cases. I don't
see any obvious reason why you would experience this behavior. If that is
the case, however, I think it involves the condititions in your particular
worksheet. I would copy the event code to a new workbook with no other code
and see if you can reproduce the problem. If not, then start introducing
other elements of your workbook and see if you can identify when the
behavior starts.

--
Regards,
Tom Ogilvy

"Jan" wrote in message
...
In a 2000 template I have a cell that has a data validation list. When the
value of this cell is changed, 2 other cells have to be cleared. This is
done by programming the worksheet_change event with a

cell().clearcontents.
This is the problem: when you type a value from the list, the event fires
and the clearcontents does its work, however if you select a value from

the
list the event also fires but the clearcontents doesn't work and doesn't

give
an error




gocush[_29_]

clearcontents, worksheet_change, cell validation
 
Jan,
A while back I had a similar problem and I think I solved it by inserting in
my code:
Range("A1").Select to get the focus away from the validation cell.

"Jan" wrote:

In a 2000 template I have a cell that has a data validation list. When the
value of this cell is changed, 2 other cells have to be cleared. This is
done by programming the worksheet_change event with a cell().clearcontents.
This is the problem: when you type a value from the list, the event fires
and the clearcontents does its work, however if you select a value from the
list the event also fires but the clearcontents doesn't work and doesn't give
an error



All times are GMT +1. The time now is 11:15 AM.

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