Hi Guys,

it s the second day I am working on VBA, so sorry if the question is too easy but I coudnīt find any other thread dealing with my issue:

I have a listbox on my Userform called ComplexityListBox. The following items can be selected "Very High" "High" "Medium" "Low" "Very Low". (In the properties window the controlSource is cell d49 of the active sheet in order to keep the selection saved after reopening the form)

I want to write a code so that the selected item is assigned to a specific numeric value (1, 2, 3, 4 ,5) and then I want this value to be transfered on the active sheet in cell d49

Heres the code, it s not working, thanks for your help

Private Sub ComplexityListBox_Change()

If ComplexityListBox.Value = "Very High" Then
        Range("d49").Value = 5
ElseIf ComplexityListBox.Value = "High" Then
        Range("d49").Value = 4
ElseIf ComplexityListBox.Value = "Medium" Then
        Range("d49").Value = 3
ElseIf ComplexityListBox.Value = "Low" Then
        Range("d49").Value = 2
Else
        Range("d49").Value = 1
End If

End Sub