Userform labels

John Davis

Well-known Member
Joined
Sep 11, 2007
Messages
3,457
Hello All:

I have a UserForm and what I'm trying too do is change the color property of all the labels on the form simultaneously. Any advice/ideas would be appreciated.
 
If you want to do all labels, you could just use:
Code:
    Dim ctl As MSForms.Control
    For Each ctl In Me.Controls
        If TypeOf ctl Is MSForms.Label Then ctl.BackColor = RGB(255, 0, 0)
    Next ctl

Hi Rory. Thanks for your reply. True, I want to do all the labels, but I wanted the forms background color to change colors while the macro is running as well. How do I modify the code too accomodate?
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Just add:
Code:
Me.BackColor = RGB(255, 0, 0)
to the end. Though why you would want a red form is beyond me! :)
 
Upvote 0
The red is my idea ;)

Thanx for your posting, I didn't know Excel VBA could do that.

Cheers!

(y)
 
Upvote 0
Just add:
Code:
Me.BackColor = RGB(255, 0, 0)
to the end. Though why you would want a red form is beyond me! :)


Thank you both. That change was the solution. I have numerous macros on the form and red indicates that the form is activated.
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top