Forum Discussion
oteixeira62
Feb 05, 2023Copper Contributor
Update (refresh) cell after programatically change the data validation
Hello to all, I have the following lines of code that work fine in setting up a new validation type for cell E4. Range("E4").Select
With Selection.Validation
.Del...
- Feb 05, 2023
That is the expected behavior. Changing the source of the data validation list does not affect the cell value, even if that value is no longer valid. Excel cannot know what the new value should be.
You could do this:
With Range("E4") With .Validation .Delete .Add Type:=xlValidateList, Formula1:="=CTRYS_MOV_ANO" End With .ClearContents End With
HansVogelaar
Feb 05, 2023MVP
Do you mean that the users don't see the new data in the drop down list?
oteixeira62
Feb 05, 2023Copper Contributor
Hello Hans,
No, they do not see the new list. The cell still shows the value of previous/validation (or selection). Only by clicking the cell the new values get available.
Octavio
No, they do not see the new list. The cell still shows the value of previous/validation (or selection). Only by clicking the cell the new values get available.
Octavio
- HansVogelaarFeb 05, 2023MVP
That is the expected behavior. Changing the source of the data validation list does not affect the cell value, even if that value is no longer valid. Excel cannot know what the new value should be.
You could do this:
With Range("E4") With .Validation .Delete .Add Type:=xlValidateList, Formula1:="=CTRYS_MOV_ANO" End With .ClearContents End With
- oteixeira62Feb 05, 2023Copper ContributorHello Hans,
I posted before reading your last advice. It is quite a good solution. Many thanks for your help.
Octavio