Conditional Formatting - Text Box

belang46

New Member
Joined
Apr 22, 2010
Messages
29
Hello all,

I am trying to conditionally format a text box (which is linked to a cell)...that if the value inside the text box doesn't equal a different cell's value, the background of the text box turns red.

I have no idea if the syntax is correct...I was looking at tutorials and just guessing (i don't name my text boxes, so i'm not even sure i'm calling it correctly...just going based on what i see in the cell reference box when i select the text box).

I'm a novice-my apologies if the answer is obvious.

Thanks for having a look and regards,
Marcus

PHP:
Private Sub TextBox23_Change()
If TextBox("Text Box 23").Value = Range("L176").Value Then _
    TextBox("Text Box 23").BackColor = RGB(200, 160, 35)
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
What kind of error is your code returning, or what's not working as you need it to?
I'm still a newbie with code, but at the least I feel you would need to end the if statement:

Rich (BB code):
Private Sub TextBox23_Change()
If TextBox("Text Box 23").Value = Range("L176").Value Then _
    TextBox("Text Box 23").BackColor = RGB(200, 160, 35)
End If
End Sub



 
Upvote 0
Thanks for the reply Cease...I tried that-still isn't working.

I'm not getting an error code actually-it's just not working at all. I am pretty sure my syntax is awfully far from the correct way.
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top