Results 1 to 21 of 21

Conditional formatting based on multiple criteria (needs to be in VBA)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-16-2009
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel XP, 2003, 2010
    Posts
    125

    Conditional formatting based on multiple criteria (needs to be in VBA)

    Hi Everyone,

    First off, in case anybody was wondering, I have searched in this forum for anything similar but haven't found anything I can easily modify for my own usage. I'd thought I'd let everyone know just in case someone suggests a search!

    I have a large worksheet which I need conditional formatting on a range of cells based on it's own value and another cell's value on the same row.
    For example, Cell L2 has a date value and cell J2 has a text value.

    I want cell L2 to be highlighted IF the date in this cell is over 15yrs before today's date and cell J2 value is "Conveyancing" OR, if cell J2 is not equal to "Conveyancing" and cell L2 is over 10yrs before today's date to be highlighted also.

    I have achieved this quite well with using the conditional formatting option under Format and it goes like this:

    =IF(AND($J2="CONVEYANCING",$L2<DATE(YEAR(NOW())-15,MONTH(NOW()),DAY(NOW()))),TRUE,IF(AND($J2<>"CONVEYANCING",$2<DATE(YEAR(NOW())-10,MONTH(NOW()),DAY(NOW()))),TRUE,FALSE))

    Now, it isn't that it doesn't work BUT, the workbook doesn't save all the formatting because (after a wee bit of digging around the MSDN forums....) there's a "limitation to how Excel saves information if there are more than 2050 rows with conditional formatting"............hence the need to do this in VBA.

    I am dealing with a BIG sheet of data, around 50,000 rows of information and I need the formatting so I can easily identify rows where it meets the above criteria (and that's just the start!!!!)

    Any help in achieving this in VBA would be mucho appreciated!

    Thanks,
    Tony
    Last edited by Fidd$; 10-12-2009 at 09:12 AM. Reason: added info

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