Results 1 to 2 of 2

Thread: Excel Macros for conditional formatting statement in Excel

  1. #1
    Join Date
    Dec 2011
    Posts
    69

    Excel Macros for conditional formatting statement in Excel

    I have a cell that is colored according to a conditional formatting statement. I want to copy the color to another cell using a macro but I can't find the property. In particular, Range.Interior.ColorIndex is NOT set. I can examine the colors using Range.FormatConditions(index) Interior.ColorIndex but I can't tell what value to use for "index" (a conditional format has up to 3 conditions and thus index is a number between 1 and 3 but I don't know which one is currently active).

  2. #2
    Join Date
    Aug 2011
    Posts
    564

    Re: Excel Macros for conditional formatting statement in Excel

    You are copying the conditional format to the other cell. If the condition isn't there then the color won’t show. If you want the color in the other cell then best just set the color. range ("a1").interior.colorindex = 42 if you don't know the color index then in a blank workbook past the following in a module. Save it for future reference.

    Code:
    Sub macGetColors()
    ' Macro written 2/10/02 by FSt1
    Sheets("Sheet1").Select
    Range("B2").Select
    Set ci = Range("A1")
    ci.Value = 1
    Set c = Range("B2")
    Do Until ci > 56
    Set c2 = c.Offset(1, 0)
    Set cnum = c.Offset(0, 1)
    c.Interior.ColorIndex = ci.Value
    c.Offset(0, 1) = ci.Value
    ci.Value = ci.Value + 1
    Set c = c2
    c.Select
    Loop
    
    End Sub

Similar Threads

  1. Replies: 3
    Last Post: 28-04-2012, 07:32 AM
  2. VBA Conditional Formatting in Microsoft Excel
    By Thedevotee in forum MS Office Support
    Replies: 4
    Last Post: 21-01-2012, 02:12 PM
  3. How to Run Excel 2003 Macros in Excel 2007
    By Ekanga in forum Windows Software
    Replies: 5
    Last Post: 19-07-2010, 02:37 PM
  4. Writing a conditional formatting with Excel 2007
    By KAMAL60 in forum Software Development
    Replies: 5
    Last Post: 23-10-2009, 06:19 PM
  5. Conditional formatting in excel
    By RockeЯ in forum Windows Software
    Replies: 4
    Last Post: 27-06-2009, 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
  •  
Page generated in 1,711,619,212.38382 seconds with 17 queries