Hi,
I'm trying to add color validation to comboboxes on a userform - but seem to be having issue with the syntax - I've done this before using defined drop down values and not had any issues.. I'm not sure how to amend this code to validate input based on using the scripting dictionary?.. can anyone help or offer advice or suggestions please?
code below
I'm trying to add color validation to comboboxes on a userform - but seem to be having issue with the syntax - I've done this before using defined drop down values and not had any issues.. I'm not sure how to amend this code to validate input based on using the scripting dictionary?.. can anyone help or offer advice or suggestions please?
code below
Code:
Private Sub cboBox1_Change()
a = Sheets("SEARCH").Range("CODES").Value
With CreateObject("scripting.dictionary")
For i = 2 To UBound(a, 1)
If a(i, 1) = (Me.cboBox1) And Not .Exists(a(i, 2)) Then .Add a(i, 2), a(i, 2) & "_content"
Next
If cboBox1.Value = a Then
cboBox1.BackColor = vbGreen
ElseIf cboBox1.Value <> a Then
cboBox1.BackColor = vbRed
End If
On Error Resume Next