+ Reply to Thread
Results 1 to 5 of 5

For loop - Conditional Formatting

  1. #1
    Registered User
    Join Date
    06-26-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    69

    For loop - Conditional Formatting

    Hi,

    Could someone please help me to make a for loop for a Conditional Formatting macro?

    Below you see what I'm gona do. But I dont want that to be applied just to G6. I need it in G6-G200 but the "6" in $H6>=$G6 must be change with the row number.
    Like G7 would get: Formula1:="=$H7>=$G7"

    Please Login or Register  to view this content.
    Thanks for the help!

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: For loop - Conditional Formatting

    You do not understand.

    G7 would get: Formula1:="=$H7>=$G7" automatically if you select your range G6 to G200 and write $H6>=$G6 in G6.

    To stop excel doing that. you must use the formula. $H6 >= $G$6 in G$6.

    So no loop is required.

  3. #3
    Registered User
    Join Date
    06-26-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: For loop - Conditional Formatting

    Thats not right. This Macro is using $H6>=$G6 for every cell. I need "6" to be a variable like the "i" for row number.
    How do I do that?

    Please Login or Register  to view this content.
    Last edited by gombi; 11-21-2014 at 04:05 PM.

  4. #4
    Forum Contributor
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: For loop - Conditional Formatting

    Hi,

    My understanding is you want apply CF if cell value in column G is greater then equal to value in column H if so you following should work for you:

    Please Login or Register  to view this content.
    Regards,

  5. #5
    Registered User
    Join Date
    06-26-2010
    Location
    Montreal
    MS-Off Ver
    Excel 2003
    Posts
    69

    Re: For loop - Conditional Formatting

    Good point. Thanks.

    This is doing what I want:
    Please Login or Register  to view this content.

+ 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. Loop within Conditional Formatting
    By daaronfriedman in forum Excel General
    Replies: 3
    Last Post: 01-12-2012, 10:18 AM
  2. Macros for conditional formatting for dynamic string using loop
    By m2_ilango in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-29-2011, 02:58 AM
  3. VB Macro, FOR loop with conditional formatting
    By RMGreenlight in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2010, 03:14 PM
  4. Conditional formatting in a loop
    By surya9 in forum Excel General
    Replies: 1
    Last Post: 02-19-2010, 04:09 PM
  5. Conditional Formatting in For:Next loop - won't work!!!
    By Cumberland in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-21-2006, 08:10 AM

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