+ Reply to Thread
Results 1 to 3 of 3

Userform textboxes font color change

  1. #1
    Registered User
    Join Date
    12-16-2020
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    8

    Userform textboxes font color change

    Hi guys, I'm new to this forum so hoping someone can help me with this problem I have.

    I have a user form which pulls data off a data table when a name is selected in the combo box, and then displays several certificate expiry due dates.

    In the data table I have a list of names (work colleague's) with certificate date entries.
    These date entries are conditionally formatted to change font colour when overdue, this works fine using conditional formatting.

    Not every work colleague's certificate date, is out of date at one particular time.

    However, when I pull the data up in the the user form the font for the dates in the textboxes remains black, regardless of colour in the database.

    In a nutshell,
    I'm looking for the dates to be red in the user form text boxes when red in the database, otherwise black.

    Really been scratching my head over the VBA code for this, hope someone can help.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Userform textboxes font color change

    Hi, welcome to the forum.
    The same formula you use in Conditional Formatting you can use in the Userform's vba code
    You use write a Function that returns the wanted colour and use it in the Textbox properties. Its the BackColor you will want

    You can also read here and use the cell colour that you have based on the conditional formatting
    https://stackoverflow.com/questions/...xcel-using-vba

    Let me/us know if you need more help
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    12-16-2020
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    8

    Re: Userform textboxes font color change

    Thank you for your help, all sorted now.

+ 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. Help with code, userform button to change cell font color
    By cybermanager in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2020, 02:27 PM
  2. Replies: 2
    Last Post: 02-04-2013, 02:00 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. change font color and font style in shape
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-05-2011, 10:05 AM
  5. [SOLVED] Pb with textboxes font size in a UserForm
    By Jean-Pierre Bidon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-14-2006, 01:55 PM
  6. [SOLVED] 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

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