+ Reply to Thread
Results 1 to 4 of 4

Color Date Cell in Column based on Criteria

  1. #1
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Color Date Cell in Column based on Criteria

    I am trying to color the cells in col L:L if the dates are less than the date entered in the field named date_lookup. this is the code that I have so far and it does not work. it highlights all dates right now. i want it to highlight only if it is greater that 1/1/2013, which is what i have in my date_lookup cell.Thanks

    Please Login or Register  to view this content.

  2. #2
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Color Date Cell in Column based on Criteria

    1) all text is "greater" than all numbers, that's an Excel thing. So "a" is greater the 1,000,000. Trust me.

    2) you defined a "string" variable in your macro and then put the date from your sheet into it. That converted that date into a STRING which is text, and ALL text is greater than all numbers. (see #1)

    Please Login or Register  to view this content.


    3) having said all that, there's no reason to do this with a macro when you can get this effect in realtime on column L by using conditional formatting.

    - Highlight column L
    - Apply a new conditional formatting rule with the formula:
    =$L1 > Date_Lookup
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    11-20-2011
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007, Excel 2003, Excel 2010
    Posts
    284

    Re: Color Date Cell in Column based on Criteria

    Thanks. and how would I add additionla columns to this condition for example :N:N. P:P, T:T etc? Thanks

  4. #4
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Color Date Cell in Column based on Criteria

    No offense, but that seems like a question you could answer for yourself by Googling or simply turning on the macro recorder and seeing how it records you selecting all those columns.

    Please Login or Register  to view this content.

    If that takes care of your original query, please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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