+ Reply to Thread
Results 1 to 6 of 6

changing userform label control's color dynamically

  1. #1
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    changing userform label control's color dynamically

    edit - file test.xlsm attached

    I'm trying to change label text colors dynamically in a user form based on the value of a checkbox.

    Objects:

    checkbox: chkTest
    label: lblTest
    textbox: txtTest

    I set label's forecolor in the control's property to red (H000000FF) then run the following code:

    Please Login or Register  to view this content.
    On initialization of the form, the label's text is properly red.

    But on chkbox click, the text turns black once and never changes again. The txtbox updates its value properly.

    What am I doing wrong?

    What I want to do is have a large section of one of my userforms to activate and change color if a particular checkbox is true. If False, then the controls are disabled and are greyed out.

    Thanks!
    Last edited by Ouka; 09-30-2014 at 02:30 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: changing user form label control's color dynamically

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    Re: changing user form label control's color dynamically

    added the file at top of original post

  4. #4
    Forum Contributor
    Join Date
    08-14-2014
    Location
    US
    MS-Off Ver
    2013
    Posts
    135

    Re: changing userform label control's color dynamically

    Something like this? Will change the checkbox forecolor
    Please Login or Register  to view this content.
    This will change the label
    Please Login or Register  to view this content.
    Last edited by Mr_Bill; 09-30-2014 at 02:16 AM.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: changing userform label control's color dynamically

    Replace your current code with the below one

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    06-02-2005
    Posts
    100

    Re: changing userform label control's color dynamically

    doh. I tried the excel pallet color, color name, and color index. i didn't try rgb or the long number form of the colors. apparently either of those would have actually worked. Thanks guys, feeling stupid now ~_~ way too many hours in front of this screen apparently...
    Last edited by Ouka; 09-30-2014 at 02:30 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 05-22-2013, 10:24 PM
  2. VBA User Form Label won't show
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-29-2011, 09:57 AM
  3. Sorting Button (form control) alphabetically based on text label
    By DTK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-30-2010, 08:48 PM
  4. Filling form fields via worksheet dropdowns, user update via form, change form color
    By Demosthenes&Locke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2010, 08:58 AM
  5. In need to format a label in an user form
    By jobro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2008, 08:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1