+ Reply to Thread
Results 1 to 5 of 5

Highlighting Closest Date

  1. #1
    Registered User
    Join Date
    04-30-2019
    Location
    Bristol, England
    MS-Off Ver
    2016
    Posts
    8

    Highlighting Closest Date

    Hi All,

    Can someone help me out to create VBA for me?
    Have a spreadsheet named "Toner" In column A showing dates of all Fridays in a year. So every Friday I`m putting stock levels in it. So what I am trying to achieve is to highlight the row closest to the Friday in the week when spreadsheet is opened. So if I open it now (30-04-2019) it would highlight in red the row with date 03-05-2019 up till column BC. Hope that makes sense

    thanks in advance!

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Highlighting Closest Date

    Hi there,

    See if the attached workbook gets you moving in the right direction - it uses the following formula to specify the Conditional Formatting of Cell A2:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,724

    Re: Highlighting Closest Date

    Why use INT(NOW()) ?

    TODAY() gives the same result.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    04-30-2019
    Location
    Bristol, England
    MS-Off Ver
    2016
    Posts
    8

    Re: Highlighting Closest Date

    Hi Greg,

    Works like magic! And I thought I will not be able to achieve this without a macro Thank you!

    Hi Pete,

    tried to swap Now() with Today() and it highlights 22-06-2019 instead of 03-05-2019. Not sure what I did wrong

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Highlighting Closest Date

    Hi again,

    Many thanks for your feedback.

    You're welcome - glad I was able to help.

    Regards,

    Greg M

+ 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: 11
    Last Post: 06-05-2023, 01:36 AM
  2. Lookup value based on closest date either side of a date
    By RollingStone88 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-10-2019, 08:38 AM
  3. VBA to loop through range to find date closest to today's date
    By esbencito in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2017, 02:08 AM
  4. Replies: 3
    Last Post: 05-16-2014, 01:23 AM
  5. [SOLVED] look-up a date in a range and find the date that is closest todays date
    By VanShark in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-12-2014, 09:46 PM
  6. Picking Closest Date from List - With Date Minimum
    By JPolvCB in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-05-2013, 12:55 AM
  7. Replies: 1
    Last Post: 05-27-2006, 04:00 PM

Tags for this Thread

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