+ Reply to Thread
Results 1 to 4 of 4

VBA conditional formatting a range

  1. #1
    Registered User
    Join Date
    03-04-2008
    Location
    Abington, Pa
    Posts
    3

    VBA conditional formatting a range

    Hi,
    I am trying to conditionally format a range of cells depending on the content of a column that is not attached to the cells that will be conditionally formatted. The column I am using is "AQ' and if the cells are populated with a "D" then the corresponding cells in columns "A:C" should be formatted as bold red, if the cells include "N", then the formatting will be black. I can get it to work for the first cell, but it will not loop through the additional cells and do the formatting. I am including the code below. Please help!


    Please Login or Register  to view this content.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650
    XL Forum_gmccray_VBA conditional formatting a range
    ----------------------
    Hi, I'm afraid your code is not looping, because the "For" statements, variable "Counter" is not in the loop, therefore no looping takes place.
    Look at your modified code, and you will see what is required, for it to work.
    I've assumed that sheet "O7 vs O8" is the activesheet.
    Please Login or Register  to view this content.
    Regards Mick

  3. #3
    Registered User
    Join Date
    08-05-2012
    Location
    ct
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: VBA conditional formatting a range

    Mike, Like your code and it works...however I'm trying to apply this logic to the form...the cells in the range on the sheet are bold and red...this data on the form is unchanged...perhaps because it was loaded 1st?...in my situation...this code is on change and I'm trying to highlite a matching value on the record to the value in a scale of values (table). example....each record could have a different value based on some total....like a...e, those values relate to a table of rates ($/) displayed on the form, a ...e and I want to highlite a matching row on the form listbox.
    thanks in advance Jim

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA conditional formatting a range

    duncanmcl,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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