Feb 05 2023 03:06 AM - edited Feb 05 2023 03:07 AM
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
.Delete
.Add Type:=xlValidateList, Formula1:="=CTRYS_MOV_ANO"
End With
The code changes the validation but is not visible to user. Is there a way to force the cell to show the new data validation?
Many thanks for any kind help.
Octavio
Feb 05 2023 03:33 AM
Do you mean that the users don't see the new data in the drop down list?
Feb 05 2023 03:47 AM
Feb 05 2023 06:57 AM
SolutionThat 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
Feb 05 2023 07:01 AM