Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Conditonally format a text box

Hi,

I have a text box in a form that will contain one of three possible options:
1) blank
2) "Go"
3) "Stop"

I am happy enough with the look of the box as I have set it up when it is
blank but is it possible to conditionally format it so that the box
background goes red when "Stop" is the value and green when "go" is the value?

TIA

Dave
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Conditonally format a text box

1. Select the cell (or cells if there are more than one)

2. Click Format/Conditional Formatting from Excel's menu bar

3. Click the Add button so that 2 Conditions sections appear

4. Select "Formula Is" from the drop down box for both conditions

5. Put this formula in the empty field for Condition1... =A1="Go"
Click the Format button and choose a green color from Patterns tab

6. Put this formula in the empty field for Condition2... =A1="Stop"
Click the Format button and choose a red color from Patterns tab

Okay your way back to the worksheet.

NOTE: I used A1 for the cell reference, but you should use the address of
the selected cell (or the active cell address if more than one cell is
selected) in place of the A1 in both formulas.

--
Rick (MVP - Excel)


"Risky Dave" wrote in message
...
Hi,

I have a text box in a form that will contain one of three possible
options:
1) blank
2) "Go"
3) "Stop"

I am happy enough with the look of the box as I have set it up when it is
blank but is it possible to conditionally format it so that the box
background goes red when "Stop" is the value and green when "go" is the
value?

TIA

Dave


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Conditonally format a text box

Rick,

Thanks for the response but I need to do this in a text box on a form using
VB.

Dave

"Rick Rothstein" wrote:

1. Select the cell (or cells if there are more than one)

2. Click Format/Conditional Formatting from Excel's menu bar

3. Click the Add button so that 2 Conditions sections appear

4. Select "Formula Is" from the drop down box for both conditions

5. Put this formula in the empty field for Condition1... =A1="Go"
Click the Format button and choose a green color from Patterns tab

6. Put this formula in the empty field for Condition2... =A1="Stop"
Click the Format button and choose a red color from Patterns tab

Okay your way back to the worksheet.

NOTE: I used A1 for the cell reference, but you should use the address of
the selected cell (or the active cell address if more than one cell is
selected) in place of the A1 in both formulas.

--
Rick (MVP - Excel)


"Risky Dave" wrote in message
...
Hi,

I have a text box in a form that will contain one of three possible
options:
1) blank
2) "Go"
3) "Stop"

I am happy enough with the look of the box as I have set it up when it is
blank but is it possible to conditionally format it so that the box
background goes red when "Stop" is the value and green when "go" is the
value?

TIA

Dave



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Conditonally format a text box

Sorry, I didn't read your question carefully (my fault). Give this TextBox
Change event code a try...

Private Sub TextBox1_Change()
Select Case UCase(TextBox1.Text)
Case "GO"
TextBox1.BackColor = vbGreen
Case "STOP"
TextBox1.BackColor = vbRed
Case Else
TextBox1.BackColor = vbWhite
End Select
End Sub

--
Rick (MVP - Excel)


"Risky Dave" wrote in message
...
Rick,

Thanks for the response but I need to do this in a text box on a form
using
VB.

Dave

"Rick Rothstein" wrote:

1. Select the cell (or cells if there are more than one)

2. Click Format/Conditional Formatting from Excel's menu bar

3. Click the Add button so that 2 Conditions sections appear

4. Select "Formula Is" from the drop down box for both conditions

5. Put this formula in the empty field for Condition1... =A1="Go"
Click the Format button and choose a green color from Patterns tab

6. Put this formula in the empty field for Condition2... =A1="Stop"
Click the Format button and choose a red color from Patterns tab

Okay your way back to the worksheet.

NOTE: I used A1 for the cell reference, but you should use the address of
the selected cell (or the active cell address if more than one cell is
selected) in place of the A1 in both formulas.

--
Rick (MVP - Excel)


"Risky Dave" wrote in message
...
Hi,

I have a text box in a form that will contain one of three possible
options:
1) blank
2) "Go"
3) "Stop"

I am happy enough with the look of the box as I have set it up when it
is
blank but is it possible to conditionally format it so that the box
background goes red when "Stop" is the value and green when "go" is the
value?

TIA

Dave




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default Conditonally format a text box

Risk,

My thanks

"Rick Rothstein" wrote:

Sorry, I didn't read your question carefully (my fault). Give this TextBox
Change event code a try...

Private Sub TextBox1_Change()
Select Case UCase(TextBox1.Text)
Case "GO"
TextBox1.BackColor = vbGreen
Case "STOP"
TextBox1.BackColor = vbRed
Case Else
TextBox1.BackColor = vbWhite
End Select
End Sub

--
Rick (MVP - Excel)


"Risky Dave" wrote in message
...
Rick,

Thanks for the response but I need to do this in a text box on a form
using
VB.

Dave

"Rick Rothstein" wrote:

1. Select the cell (or cells if there are more than one)

2. Click Format/Conditional Formatting from Excel's menu bar

3. Click the Add button so that 2 Conditions sections appear

4. Select "Formula Is" from the drop down box for both conditions

5. Put this formula in the empty field for Condition1... =A1="Go"
Click the Format button and choose a green color from Patterns tab

6. Put this formula in the empty field for Condition2... =A1="Stop"
Click the Format button and choose a red color from Patterns tab

Okay your way back to the worksheet.

NOTE: I used A1 for the cell reference, but you should use the address of
the selected cell (or the active cell address if more than one cell is
selected) in place of the A1 in both formulas.

--
Rick (MVP - Excel)


"Risky Dave" wrote in message
...
Hi,

I have a text box in a form that will contain one of three possible
options:
1) blank
2) "Go"
3) "Stop"

I am happy enough with the look of the box as I have set it up when it
is
blank but is it possible to conditionally format it so that the box
background goes red when "Stop" is the value and green when "go" is the
value?

TIA

Dave






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
If formula to conditonally format a cell Very Basic User Excel Discussion (Misc queries) 1 July 6th 09 06:14 PM
Need help with converting CUSTOM format/TEXT format to DATE format Deo Cleto Excel Worksheet Functions 6 June 2nd 09 08:14 PM
Change Date Format to Specific Text Format When Copying [email protected] Excel Discussion (Misc queries) 4 December 23rd 08 03:43 PM
conditonally formatting decimal places BigMikeGallagher Excel Discussion (Misc queries) 0 April 6th 06 06:08 PM
how to format excel format to text format with separator "|" in s. azlan New Users to Excel 1 January 31st 05 12:57 PM


All times are GMT +1. The time now is 07:37 PM.

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

About Us

"It's about Microsoft Excel"