check validation data, return TRUE or FALSE

  • I have validation data " Yes and NO" set up on a sheet. How can I check if selection is "YES" or "NO"? e.g return TRUE if YES, False if NO
    Any help will be appreciated.
    Thank you


    Code;


  • TRY THIS


  • sorri change to

  • Great thanks for the code, more efficient way of setting up. For "YES" or "NO" (hide or show sheet) decision I have setup code below which works well.


    For Each Ws In ThisWorkbook.Worksheets
    .
    .
    .
    For Each CellRange In Ws.Cells.SpecialCells(xlCellTypeAllValidation).Cells
    With CellRange
    If .Validation.Type = xlValidateList Then
    If .Value = .Range("D1:D1").Value Then
    Ws.Visible = True
    Else
    Ws.Visible = False
    End If
    End If
    End With
    Next CellRange
    .
    .
    .
    Next Ws

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!