Change back color of all textbox at the same time

Hudas

Registered User.
Local time
Yesterday, 19:14
Joined
May 13, 2013
Messages
55
Solved: Change back color of all textbox at the same time

Hi -

Is their a way to change the back color of a textbox at the same time? because i have almost 50 textbox and I want to code each textbox and change the back color becuase its just to many.


Using VBA

Thank you
 
Last edited:
You can select multiple textboxes by clicking/dragging or holding down Shift while clicking on them. Then any change made to the properties window will apply to all.
 
Sorry, pbaldy...I forgot to say that I need it in VBA....I think this should be in Modules & VBA section... How do I transfer this post their?
 
To simply change this property for the Textboxes, permanently

In Form Design View

  1. Press and hold down the <Shift> Key
  2. Select, in turn, each Textbox you want to format
  3. Go to Properties - Format
  4. Go to the Back Color Property
  5. Select the color you want
Linq ;0)>

Late note:

Sorry, was slow getting my post sent!

Follow the above instructions, but go to the Other Tab then set the Tag Properties and enter Change (just like that, with no quote marks.) Then, in whatever event is appropriate (maybe Form_Load?)

Code:
Dim ctrl As Control

For Each ctrl In Me.Controls
    If ctrl.Tag = "Change" Then
       ctrl.BackColor = vbRed
    End If
Next
 
Last edited:
I moved the thread and will get out of the way so Linq can take over.
 
You can place this code in the Onload event of your form and this will change all of your boxes at one time.

Delcare the control:

Dim tb as Control





Code:
 For Each tb In Me.Controls
        If TypeOf tb Is TextBox Then
            tb.BackColor = 'your color goes here
        End If
    Next

Whoops! too late. Sorry!
 
Thank you! pbaldy, missinglinq and magster!!
 

Users who are viewing this thread

Back
Top Bottom