I have this userform with listbox, and I want something to have a color validation depending on what the user select in the Listbox, for Example if the user selected "Review" the font will change into rgbOrange etc.. depending on the list was selected. below is the standard code with out color validation.
Code:
Private Sub OptionButton1_Click()
Dim x As Integer
Dim tVal As String
Dim tLen As Integer
Dim t1 As Integer
Dim t2 As Integer
If Me.TaskList.ListCount = 0 Then GoTo exitSub
For x = 0 To Me.TaskList.ListCount - 1
If Me.TaskList.Selected(x) And viaForm = True Then
With ActiveCell
If Len(Trim(.Value)) > 0 Then .Value = .Value & Chr(10)
.Value = .Value & Me.TaskList.List(x)
t1 = InStr(1, ActiveCell.Value, Me.TaskList.List(x))
.Characters(Start:=t1, Length:=Len(Me.TaskList.List(x))).Font.Color = vbBlack
End With
End If
Next x
For x = 0 To Me.TaskList.ListCount - 1
Me.TaskList.Selected(x) = False
Next x
exitSub:
OptButtons_False
Me.OptionButton1.Value = False
Init_TaskList
chk_Selected
End Sub