Excel found unreadable content - Data Validation

后端 未结 5 1247
长发绾君心
长发绾君心 2020-12-17 01:49

I have some combo boxes that I populate on opening of the workbook - the source of the data comes from a database.

I populate my combo boxes using data validation wi

5条回答
  •  清歌不尽
    2020-12-17 02:05

    It seems that you are right with the string length of Validation formula1 parameter. My suggestion for you is as follows (additional information are placed as comments within the code):

    'Split your list into array, or if data are Array before you _
    create List variable you could combine some of earlier steps _
    of your code
    
        List = Split(List, ",")
    'paste your list into hidden sheet as of A1 direction bottom, _
    we need to transpose our Array to do so
        Sheets("hidden").Range("a1").Resize(UBound(List) + 1, 1) = Application.Transpose(List)
    
     With Selection.Validation
        .Delete
        'here we need to change definition of formula
        .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, _
        Formula1:="=Hidden!A1:A" & UBound(List) + 1
        .IgnoreBlank = False
        .InCellDropdown = True
        .ShowInput = True
        .ShowError = True
      End With
    

提交回复
热议问题