+ Reply to Thread
Results 1 to 6 of 6

Using VBA to change colour in cells depending on date

  1. #1
    Registered User
    Join Date
    01-04-2020
    Location
    Devon
    MS-Off Ver
    2016
    Posts
    3

    Using VBA to change colour in cells depending on date

    I want to use VBA to help highlight when the training needs refreshing every 3 years and I want the cells in one Colum to change colour. Green, Orange, Red.

    Green current date until: Orange when 6 months left then Red with only a 14 days left before expiry. Then back to green when refreshed.

    It might be easy but I have not found anything as yet.

    Cheers in advance.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,335

    Re: Using VBA to change colour in cells depending on date

    attach worksheet as requested in 'yellow banner'
    this will get a faster response.

  3. #3
    Registered User
    Join Date
    01-04-2020
    Location
    Devon
    MS-Off Ver
    2016
    Posts
    3

    Re: Using VBA to change colour in cells depending on date

    I want the dates in Colum B to change colour as posted above
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,736

    Re: Using VBA to change colour in cells depending on date

    As this has been sitting a couple of days, I thought that proposing formula based conditional formatting might be appropriate:
    Red: =AND(B2<>"",TODAY()+14>=DATE(YEAR(B2)+3,MONTH(B2),DAY(B2)))
    Orange: =AND(B2<>"",TODAY()>=DATE(YEAR(B2)+2,MONTH(B2)+6,DAY(B2)))
    Green: =B2<>""
    Note that once the conditional formatting is set up on one of the sheets format painter may be used to transfer to the other sheets.
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Registered User
    Join Date
    01-04-2020
    Location
    Devon
    MS-Off Ver
    2016
    Posts
    3

    Re: Using VBA to change colour in cells depending on date

    Thank you

    Its look like just what I wanted

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,736

    Re: Using VBA to change colour in cells depending on date

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

+ 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. Unable to make a cell change colour depending on another cells date.
    By rjhardman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 12-09-2015, 12:13 PM
  2. Change The Colour Of Text In A Row Depending On The Date Entered
    By Doop Dude in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-25-2013, 09:58 AM
  3. Replies: 5
    Last Post: 02-06-2013, 02:11 PM
  4. Replies: 2
    Last Post: 09-12-2011, 07:22 AM
  5. Replies: 0
    Last Post: 09-08-2011, 10:12 AM
  6. Change Cell Colour Depending on Date
    By Owlsfan in forum Excel General
    Replies: 2
    Last Post: 07-27-2008, 06:15 AM
  7. [SOLVED] Change the colour of a row depending on the contents of a date cell
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-17-2006, 06:30 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