Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default TextBox Color Red if Less than 50

Hi Everyone,

I have a textbox in userform, I want to change the TextColor (interior
color) if the value is less than 50 then it will be Blue. (to show the
quantity is less)

Regards.

Shahzad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default TextBox Color Red if Less than 50

On Aug 4, 4:12*pm, Shazi wrote:
Hi Everyone,

I have a textbox in userform, I want to change the TextColor (interior
color) if the value is less than 50 then it will be Blue. (to show the
quantity is less)

Regards.

Shahzad

Hello try this

Private Sub TextBox1_Change()
If TextBox1.Value < 50 Then TextBox1.BackColor = &HFF0000 Else
TextBox1.BackColor = &HFFFFFF

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TextBox Color Red if Less than 50

This way maybe...

Private Sub TextBox1_Change()
If Val(TextBox1.Text) < 50 Then
TextBox1.BackColor = vbRed
Else
TextBox1.BackColor = vbWhite
End If
End Sub

Rick


"Shazi" wrote in message
...
Hi Everyone,

I have a textbox in userform, I want to change the TextColor (interior
color) if the value is less than 50 then it will be Blue. (to show the
quantity is less)

Regards.

Shahzad


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default TextBox Color Red if Less than 50

Sorry, I couldn't tell if you were trying to change the font color or
the text box color. my previous post will change the text box color,
the code below will change the font color.

Private Sub TextBox1_Change()
If TextBox1.Value < 50 Then TextBox1.ForeColor = &HFF0000 Else
TextBox1.ForeColor = &HFFFFFF

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
set color of textbox (shape) bullets Pat D[_2_] Excel Programming 6 March 21st 08 10:17 AM
How to have textbox font color change? Phrank Excel Programming 3 September 11th 07 04:14 AM
Match TextBox Back Color to Cell Fill Color AMY Z. Excel Programming 4 October 12th 06 06:07 PM
TextBox Color Change Lenny_821[_16_] Excel Programming 3 June 20th 05 03:21 PM
Browse Forms Controls and change TextBox color based on cell color StefanW Excel Programming 2 November 21st 04 07:06 PM


All times are GMT +1. The time now is 12:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"