+ Reply to Thread
Results 1 to 9 of 9

Change label caption's font color based on value in another textbox

  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Change label caption's font color based on value in another textbox

    Hi Forum,

    I had some help in here previously with finding a way to change a label caption based on a date value in a corresponding textbox... Now, I'm hoping to receive some help to change the captions font color. Below is the code I'm currently using to change the label's caption:

    Please Login or Register  to view this content.
    What I would like is for the caption's font to appear green if it meets criteria for the "Case True" statement in the above select case. Any help? Thanks!

  2. #2
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: Change label caption's font color based on value in another textbox

    The usual approach is do the task with record macro running and see what it generates. I tried that (XL2007) and it recorded everything [I]except the colour change. That may not mean it cannot be done but it renders this post less valuable than I had hoped!

  3. #3
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Change label caption's font color based on value in another textbox

    hi baker,

    Thanks for the reply. It seems like you should be able to do using
    Please Login or Register  to view this content.
    within the Select Case statement...but I haven't been able to make it work. Anybody else have any suggestions? Thanks!

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Change label caption's font color based on value in another textbox

    I don't believe Red and Green are options for lable forecolor. To view your options, click the label, and then click the ForeColor drop down box in the properties window. You might have to change the border/background by putting a picture object behind it.

    Edit: Just found the pallet... will work on code.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Change label caption's font color based on value in another textbox

    Please Login or Register  to view this content.
    The name of the forecolor appears in the forecolor box after you've selected in from the pallet, you can use this.

    edit: Ex: Green - H0000C000
    Red - H000000FF

    Untested.
    Last edited by Solus Rankin; 07-19-2013 at 01:49 PM.

  6. #6
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Change label caption's font color based on value in another textbox

    Quote Originally Posted by XeRo Solus View Post
    Edit: Just found the pallet... will work on code.
    Hi Solus,

    Thanks for the reply. Can you show me the code you believe will work? I've tried the following and it doesn't seem to work... (bold added for emphasis)

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Change label caption's font color based on value in another textbox

    Please see post #5

  8. #8
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Change label caption's font color based on value in another textbox

    Quote Originally Posted by XeRo Solus View Post
    Please see post #5
    Thanks Solus! I think I was typing my reply before I saw the edit to this post.... It is working! Thanks!!

  9. #9
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Change label caption's font color based on value in another textbox

    No problem. If you're happy with the solution please mark the thread as [SOLVED].

+ 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. [SOLVED] Assign label caption based off of textbox value
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-17-2013, 12:36 PM
  2. Change Font Color Based On Adjacent Cell Color
    By Zorro9758 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2013, 02:47 PM
  3. Change font color based on font color of another cell
    By Ibyers in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2012, 09:36 AM
  4. Userform-Change textbox color and font based on input in other tex
    By Neal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-21-2005, 08:05 PM
  5. [SOLVED] Format Label.Caption or Textbox data
    By RobC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2005, 08:06 PM

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