Hello BDB,
You only need to set the back color to yellow when the UserForm is initialized because it will come white by default. To change the color based on the contents of the TextBox, you need to add code to Change event. The code is below.
Private Sub TextBox1_Change()
Dim lngYellow As Long, lngWhite As Long
lngYellow = RGB(252, 248, 61)
lngWhite = RGB(255, 255, 255)
TextBox1.BackColor = lngWhite
If TextBox1.Value = "" Then TextBox1.BackColor = lngYellow
End Sub
Private Sub UserForm_Initialize()
TextBox1.BackColor = RGB(252, 248, 61)
End Sub
Bookmarks