DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Excel macro-If Cell has Conditional Format

  1. #1
    Join Date
    Jul 2008
    Posts
    1

    Excel macro-If Cell has Conditional Format

    I am trying to write some code that will check if Column Y="N" and if it does it will check Column R, O, G and if there is no color index in any of the Columns the macro will delete the row.

    Column Y-has Y, N entered in cells
    Column R-has 1,2, etc... entered in cells ( some cells have color index 26 ) Color set by Conditional Format
    Column O-has 1, 2, etc... entered in cells ( some cells have color index 3 ) Color Set By Format
    Column G-has names entered entered in cells ( some cells have color index 38 ) Color set by Conditional Format

    There are 3000 rows on the spreadsheet and the macro would need to loop through all the rows. I have made several atempts with no luck. Any help would be greatly appreciated.

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    202
    Here are some resources that have sample of looping over a range of cells and manipulating cells and their data.

    http://www.exceltip.com/st/Using_Loo...Excel/628.html

    http://support.realsoftware.com/list.../msg00980.html

    http://www.cpearson.com/excel/optimize.htm

    Good luck,
    Michael Sanchez
    Managing Technical Editor
    Forum Moderator
    FreeVBCode.com

  3. #3
    Join Date
    Aug 2004
    Location
    Orange, California
    Posts
    1,263
    I did a simple test in excel. I set a conditional format that changes the font color to red if the cell contains a certain value. I looped through each cell and dumped the Font Color and ColorIndex items out to the debug window.
    Even though some of the cells were clearly red the values for each cell was the same. I could find no way to detect that the conditional formatting had triggered.
    So even though the conditional formatting was clearly displayed, I could find no programmatic way to determine if the cell's conditional formatting had triggered or not.
    With the FormatConditions collection you can Add, Modify, and Delete conditional formats; but again I found no way to detect if one had triggered.
    Sorry!

Similar Threads

  1. Replies: 1
    Last Post: 01-02-2007, 09:58 AM
  2. Excel Macro Help Request!!!
    By TatesMommy in forum VB Classic
    Replies: 1
    Last Post: 10-16-2006, 10:31 AM
  3. Replies: 0
    Last Post: 03-28-2006, 10:50 AM
  4. Replies: 0
    Last Post: 06-26-2005, 07:49 AM
  5. Matching data macro in VBA Excel
    By Werner in forum VB Classic
    Replies: 2
    Last Post: 06-15-2005, 02:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center