Adding additional Conditions to Conditional Formatting

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mlgmlg
    New Member
    • Aug 2008
    • 6

    Adding additional Conditions to Conditional Formatting

    Hello,

    I have a text box (on a Single Form) that I use to color code milestones based on a value. I use the “Conditional Formatting” tool to format four of the conditions, which works great! Unfortunately, I need an additional two conditions for a total of six.

    I believe the additional two conditions must be created by using code to accomplish what I need, but I do not have a whole lot of knowledge in coding. I am wondering if someone can assist me with creating the last two conditions.

    I need a text box (txtbox_status) to turn “Green” when I enter the number “5” in the text box and “Pink” when I enter the number 6.

    Appreciate any help I can get.
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    I need a text box (txtbox_status) to turn “Green” when I enter the number “5” in the text box and “Pink” when I enter the number 6.
    Code:
    Private Sub txtbox_status_Change()
    
    If Me.txtbox_status.Value = 5 Then
            Me.txtbox_status.BackColor = vbGreen
    ElseIf Me.txtbox_status.Value = 6 Then
            Me.txtbox_status.BackColor = vbPink   ' <<try vbCyan or vbMagenta if pink not recognized
    End If
    End Sub

    Comment

    Working...