Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ----------------------------------------------------------------
- ' Purpose: Function to check if a sheet contains any data validation
- ' ----------------------------------------------------------------
- Function F_sheetHasDataValidation(sh As Worksheet) As Boolean
- Dim dataValRange As Range
- 'Trying to assign data validation cells to a range object, if there is no data validation cells on
- 'the sheet dataValRange remains Nothing
- On Error Resume Next
- Set dataValRange = sh.Cells.SpecialCells(xlCellTypeAllValidation)
- On Error GoTo 0
- 'If dataValRange is Nothing there is no data validation cell on the sheet
- If dataValRange Is Nothing Then
- F_sheetHasDataValidation = False
- Else
- F_sheetHasDataValidation = True
- Set dataValRange = Nothing
- End If
- End Function
Advertisement