Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TextBox BackColor


Hi All,

I've got about 10 TextBox's on a UserForm. How can I change the
BackColor of the TextBox (Double Click) with 1 Code?



Lenny


--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...o&userid=15179
View this thread: http://www.excelforum.com/showthread...hreadid=379294

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TextBox BackColor


This is probably what you need....

Private Sub CommandButton1_Click()

For Each oCtl In Me.Controls
If TypeName(oCtl) = "TextBox" Then
oCtl.BackColor = 255 ' change the color to red
End If
Next oCtl

End Sub



A similar query was answered by Bob Phillips in thread:
http://excelforum.com/showthread.php?t=378495


Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=379294

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TextBox BackColor


Hi,

Thanks for replying.

What I am looking for is when I double click on the TextBox itself.

Sorry about the confusion.

Lenny


--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...o&userid=15179
View this thread: http://www.excelforum.com/showthread...hreadid=379294

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default TextBox BackColor

sample:

Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
With TextBox1
Select Case .BackColor
Case vbWindowBackground
.BackColor = vbRed
Case vbRed
.BackColor = vbGreen
Case vbGreen
.BackColor = vbWindowBackground
Case Else 'you shouldnt need this :)
debug.print .backcolor
stop
End Select
End With
End Sub





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Lenny_821 wrote :


Hi All,

I've got about 10 TextBox's on a UserForm. How can I change the
BackColor of the TextBox (Double Click) with 1 Code?



Lenny

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TextBox BackColor


Hi,

The examples I get only refers to 1 TextBox.

What i am looking for is when any TextBox is double clicked it changes
the BackColor. And that in 1 code.

Lenny :) :)


--
Lenny_821
------------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...o&userid=15179
View this thread: http://www.excelforum.com/showthread...hreadid=379294



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default TextBox BackColor


create a class for those textboxes.
described:
http://www.j-walk.com/ss/excel/tips/tip44.htm



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Lenny_821 wrote :


Hi,

The examples I get only refers to 1 TextBox.

What i am looking for is when any TextBox is double clicked it changes
the BackColor. And that in 1 code.

Lenny :) :)

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default TextBox BackColor


That's great, thanks:)

Lenn

--
Lenny_82
-----------------------------------------------------------------------
Lenny_821's Profile: http://www.excelforum.com/member.php...fo&userid=1517
View this thread: http://www.excelforum.com/showthread.php?threadid=37929

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
Is there a way to count cells in a range with a given backcolor? David Excel Worksheet Functions 11 October 17th 07 04:03 PM
Worksheet backcolor within range Stanley Excel Discussion (Misc queries) 2 January 25th 06 09:33 PM
Changing backcolor of commandbutton scottnshelly[_21_] Excel Programming 2 April 22nd 04 11:27 PM
Pivot DataRange BackColor Charly[_3_] Excel Programming 2 April 18th 04 02:08 PM
BackColor property code Joe Mathis Excel Programming 3 December 9th 03 04:11 PM


All times are GMT +1. The time now is 12:06 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"