Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Change Text Box Color When Typed In

Is it possible for a text box to be one color when blank, but change to
another color when the user types something into it?

When it's blank, I want it to be yellow.

After the user types in it, I want it to change to white.

Thoughts?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 964
Default Change Text Box Color When Typed In

This code should do the trick.

Private Sub TextBox1_LostFocus()
If TextBox1.Value < "" Then
TextBox1.BackColor = RGB(255, 255, 255)
Else:
TextBox1.BackColor = RGB(255, 255, 0)
End If
End Sub

HTH,
Elkar

"Paperback Writer" wrote:

Is it possible for a text box to be one color when blank, but change to
another color when the user types something into it?

When it's blank, I want it to be yellow.

After the user types in it, I want it to change to white.

Thoughts?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Change Text Box Color When Typed In

I'm putting this in EXACTLY, and it isn't working. Thoughts?

Private Sub TextBox12_LostFocus()
If TextBox12.Value < "" Then
TextBox12.BackColor = RGB(255, 255, 255)
Else:
TextBox12.BackColor = RGB(255, 255, 0)
End If
End Sub


"Elkar" wrote:

This code should do the trick.

Private Sub TextBox1_LostFocus()
If TextBox1.Value < "" Then
TextBox1.BackColor = RGB(255, 255, 255)
Else:
TextBox1.BackColor = RGB(255, 255, 0)
End If
End Sub

HTH,
Elkar

"Paperback Writer" wrote:

Is it possible for a text box to be one color when blank, but change to
another color when the user types something into it?

When it's blank, I want it to be yellow.

After the user types in it, I want it to change to white.

Thoughts?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Change Text Box Color When Typed In

Where did you 'put' this?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Paperback Writer" wrote in
message ...
I'm putting this in EXACTLY, and it isn't working. Thoughts?

Private Sub TextBox12_LostFocus()
If TextBox12.Value < "" Then
TextBox12.BackColor = RGB(255, 255, 255)
Else:
TextBox12.BackColor = RGB(255, 255, 0)
End If
End Sub


"Elkar" wrote:

This code should do the trick.

Private Sub TextBox1_LostFocus()
If TextBox1.Value < "" Then
TextBox1.BackColor = RGB(255, 255, 255)
Else:
TextBox1.BackColor = RGB(255, 255, 0)
End If
End Sub

HTH,
Elkar

"Paperback Writer" wrote:

Is it possible for a text box to be one color when blank, but change to
another color when the user types something into it?

When it's blank, I want it to be yellow.

After the user types in it, I want it to change to white.

Thoughts?


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Change Text Box Color When Typed In

I right-clicked on the tab, selected "View Code," and then put it in the box
where you put visual basic code.


"Nick Hodge" wrote:

Where did you 'put' this?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Paperback Writer" wrote in
message ...
I'm putting this in EXACTLY, and it isn't working. Thoughts?

Private Sub TextBox12_LostFocus()
If TextBox12.Value < "" Then
TextBox12.BackColor = RGB(255, 255, 255)
Else:
TextBox12.BackColor = RGB(255, 255, 0)
End If
End Sub


"Elkar" wrote:

This code should do the trick.

Private Sub TextBox1_LostFocus()
If TextBox1.Value < "" Then
TextBox1.BackColor = RGB(255, 255, 255)
Else:
TextBox1.BackColor = RGB(255, 255, 0)
End If
End Sub

HTH,
Elkar

"Paperback Writer" wrote:

Is it possible for a text box to be one color when blank, but change to
another color when the user types something into it?

When it's blank, I want it to be yellow.

After the user types in it, I want it to change to white.

Thoughts?




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,173
Default Change Text Box Color When Typed In

a) Is it a textbox from the control toolbox (activeX) not from the forms
toolbox?
b) Have you switched off design mode
c) Is the textbox called textbox12?

Works fine for me

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Paperback Writer" wrote in
message ...
I right-clicked on the tab, selected "View Code," and then put it in the
box
where you put visual basic code.


"Nick Hodge" wrote:

Where did you 'put' this?

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Paperback Writer" wrote in
message ...
I'm putting this in EXACTLY, and it isn't working. Thoughts?

Private Sub TextBox12_LostFocus()
If TextBox12.Value < "" Then
TextBox12.BackColor = RGB(255, 255, 255)
Else:
TextBox12.BackColor = RGB(255, 255, 0)
End If
End Sub


"Elkar" wrote:

This code should do the trick.

Private Sub TextBox1_LostFocus()
If TextBox1.Value < "" Then
TextBox1.BackColor = RGB(255, 255, 255)
Else:
TextBox1.BackColor = RGB(255, 255, 0)
End If
End Sub

HTH,
Elkar

"Paperback Writer" wrote:

Is it possible for a text box to be one color when blank, but change
to
another color when the user types something into it?

When it's blank, I want it to be yellow.

After the user types in it, I want it to change to white.

Thoughts?



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
Change text into time need help Excel Discussion (Misc queries) 3 September 13th 06 09:57 PM
Text entries behaving like numbers jkiser Excel Discussion (Misc queries) 12 August 30th 06 09:29 PM
Text Color Change prompted by different columns NKDodd Excel Worksheet Functions 1 August 15th 06 08:13 PM
Change number in Text Box in Excel Jerry Dyben Excel Discussion (Misc queries) 2 September 23rd 05 02:40 AM
How do I change the default cell formatting to be text? mojitsu Excel Discussion (Misc queries) 2 August 18th 05 05:37 PM


All times are GMT +1. The time now is 01:29 PM.

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"