Hey guys,

I have an URGENT problem.

I create a dropdown list with the following code:

Sub create_priorityList()

Dim ws As Worksheet
Dim shtCut As String
Dim priorityArr As Variant
Dim priorSt As String

priorityArr = priority_array
priorSt = Join(priorityArr, ",")
Debug.Print "priorSt: " & priorSt & "; Länge: " & Len(priorSt)
Call sec_mod.unlckSh(Tabelle1)
For Each ws In ThisWorkbook.Worksheets
    shtCut = auto.searchMassTable(ws.codeName, 4, 2)
    
    If shtCut <> "" And shtCut <> "dummy" Then
        If Not Tabelle1.Range(shtCut & "_priority").Validation Is Nothing Then
                   Tabelle1.Range(shtCut & "_priority").Validation.Delete
        End If
            With Tabelle1.Range(shtCut & "_priority").Validation
                .Delete
                .Add Type:=xlValidateList, AlertStyle:=xlValidateList, Operator:= _
                    xlEqual, Formula1:=priorSt
                .IgnoreBlank = True
                .InCellDropdown = True
                .InputTitle = ""
                .ErrorTitle = ""
                .InputMessage = ""
                .ErrorMessage = ""
                .ShowInput = True
                .ShowError = True
            End With
    End If
Next ws
Call sec_mod.lckSh(Tabelle1)
End Sub
Function priority_array() As Variant

    Dim j As Integer
    Dim total As Long
    Dim arr As Variant
    
    total = Tabelle5.Range("sum_active_mn").Value    'counts visible maßnahmen
    Debug.Print "Total: " & total
    ReDim arr(1 To total)
    For j = 1 To total
        arr(j) = j
    Next j
    
    priority_array = arr
End Function

The problem is: sometimes, the number are not shown as different selectable items, but the string is shown as ONE item. Screenshot is attached. This only occurs sometimes, though?!

Any ideas?

driopdown.jpg

Many thanks,
Klaster