Forum Discussion

oteixeira62's avatar
oteixeira62
Copper Contributor
Feb 05, 2023
Solved

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...
  • HansVogelaar's avatar
    HansVogelaar
    Feb 05, 2023

    oteixeira62 

    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

Resources