+ Reply to Thread
Results 1 to 2 of 2

Using loops to set conditional formating

  1. #1
    Registered User
    Join Date
    06-06-2011
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    1

    Using loops to set conditional formating

    i have a worksheet that contains a listing of general information for a number objects in a workshop. a key use of the sheet is to determine whether these items are cleared for use. I wanted to use conditional formatting to color code the cells containing the object names. this coding would rely on conditions such as the objects clearance and location, as well as that of fixtures associated with it. Said information is contained in cells within the same row as the object and are color coded (formatted) as well. The problem i face is that there are several hundred of these objects in the sheet so formatting each cell by hand is out of the question.

    I began attempting to create a "test" Marco (which should result in only a single formula based formatting for an object's "fixture" cells) the steps the code takes are as follows:

    1.loops through each row in a specified range searching for an entry in the "B" column

    2. if an entry is found in a cell along "B" , the program then begins looping through the "F-J" columns of the same row searching for entries

    3. each time it finds an entry a cell further down the row (in the "N-R" columns corresponding to the "F-J" respectively) will be formatted to change color if it contains a certain phrase.

    When i run the macro i don't get an error, but neither is there any formatting. done to any cell in the sheet.

    i'm not sure where the code is failing, or whether it is built logically/correctly for this task (i'm fairly new to Visual basic, and programing for that matter), so i could use some help.
    Please Login or Register  to view this content.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Using loops to set conditional formating

    You don't have to format each cell by hand. You can create the conditional formatting of the fisrt cell and then copy it to all other cells you want. When you manage the conditional formatting, you have a column that says "Applies to". click on this and select all the cells you want to be formatted like this. Don't forget to remove the absolute ($) reference of cells in your formula as others cells will only refer to this one.
    Good luck.

+ 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