Iterate through an Excel dropdown/validation list

后端 未结 1 421
刺人心
刺人心 2021-01-15 13:14

I have a cell with a validation list that changes depending on other settings. Is it possible to iterate through that cell in code? Is it also possible to set that cell to

相关标签:
1条回答
  • 2021-01-15 13:35

    This will work for you

    Sub loopthroughvalidationlist()
         Dim inputRange As Range
         Dim c As Range
         Set inputRange = Evaluate(Range("D2").Validation.Formula1)
         For Each c In inputRange
            '... do something with c.Value
        Next c
    End Sub
    
    0 讨论(0)
提交回复
热议问题