Determine if cell contains data validation

后端 未结 7 1429
盖世英雄少女心
盖世英雄少女心 2020-11-28 15:40

I am writing a VBA code that goes through a range of cells checking if each cell has data validation (drop down menu) and if not assign one to it from a list on another shee

7条回答
  •  难免孤独
    2020-11-28 16:34

    Dim cell As Range, v As Long
    
    For Each cell In Selection.Cells
        v = 0
        On Error Resume Next
        v = cell.SpecialCells(xlCellTypeSameValidation).Count
        On Error GoTo 0
    
        If v = 0 Then
            Debug.Print "No validation"
        Else
            Debug.Print "Has validation"
        End If
    Next
    

提交回复
热议问题