xlf | GetDVListSource function


GetDVListSource - about the function


Description: returns the Source range for the Data Validation - Allow - List selection

Syntax: GetDVListSource(Source).

Arguments: Source (required): the source range, a 1 x 1 array.


GetDVListSource - the VBA code



Code 1: Function GetDVListSource returns the Source range for the Data > Validation - Validation Criteria - Allow - List selection
Function GetDVListSource(Source As Range) As String
    If Source.Rows.Count > 1 Or Source.Columns.Count > 1 Then Exit Function
    If Source.Validation.Type = xlValidateList Then getDVListSource = Source.Validation.Formula1
End Function