+ Reply to Thread
Results 1 to 6 of 6

How to recreate conditional formatting using VBA

  1. #1
    Registered User
    Join Date
    10-02-2015
    Location
    Pennsylvania
    MS-Off Ver
    2007
    Posts
    33

    Question How to recreate conditional formatting using VBA

    Hi all,

    I've searched all over the net for this one since I thought it would be a popular question, but unfortunately couldn't find a solution.

    Would anyone know how to (using VBA only) perform a VBA "conditional format" so that every cell in col R, that contains the word "YES" will have a green background?

    ...ps: This needs to be done via VBA only since I need to run the code from a personal.xlsb file.

    Thanks so much,
    JMC

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to recreate conditional formatting using VBA

    Hi,

    One way, and I presume you don't want literally all the 1 million+ rows to be subjected to this, in which case edit the R:R range as necessary

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    10-02-2015
    Location
    Pennsylvania
    MS-Off Ver
    2007
    Posts
    33

    Smile Re: How to recreate conditional formatting using VBA

    Thanks so much, Richard!

    ps: After noticing that it worked only after the 2nd run, I realized I needed to copy the last "AutoFilter" line to the beginning to get it to work properly in Excel 2007. With that small tweak, this worked perfectly! Thanks again, Richard! -jmc

    Please Login or Register  to view this content.
    Last edited by jmccoughlin; 11-02-2015 at 11:16 PM.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How to recreate conditional formatting using VBA

    i think you already figured it out but when using autofilter

    to ensure it is correctly working
    turn it off autofilter first then apply filter new filter

    Please Login or Register  to view this content.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Registered User
    Join Date
    10-02-2015
    Location
    Pennsylvania
    MS-Off Ver
    2007
    Posts
    33

    Re: How to recreate conditional formatting using VBA

    Thanks also, humdingaling! This looks like an even cleaner approach to take care of that issue, and will also use that suggestion as well! -jmc

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: How to recreate conditional formatting using VBA

    Quote Originally Posted by jmccoughlin View Post
    Thanks so much, Richard!

    ps: After noticing that it worked only after the 2nd run, I realized I needed to copy the last "AutoFilter" line to the beginning to get it to work properly in Excel 2007. With that small tweak, this worked perfectly!

    Yes, good catch and well spotted. Mea culpa

+ 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. Opening xlsm files with conditional formatting opens with removed conditional formatting
    By Martijn.Steenbakker in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-07-2014, 05:38 AM
  2. Cant recreate a simple graph
    By Scarfer Brad in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-22-2013, 07:10 PM
  3. How do i recreate this graph
    By Selwof in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 09-09-2009, 12:28 PM
  4. How do i recreate this graph
    By Selwof in forum Excel General
    Replies: 1
    Last Post: 09-09-2009, 08:21 AM
  5. How do I recreate several spreadsheets the easy way
    By Newbieexcelguy in forum Excel General
    Replies: 2
    Last Post: 01-02-2009, 09:56 AM
  6. How in the world do I recreate this chart?
    By fitzy7722 in forum Excel General
    Replies: 1
    Last Post: 07-08-2008, 03:26 PM
  7. [SOLVED] Recreate AutoScroll
    By rjamison in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-13-2005, 08:05 PM
  8. [SOLVED] Recreate AutoScroll
    By Soli3d in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-20-2005, 12:06 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