Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conditional Formatting (Excel 2003 / VBA)

    Hi

    I am trying to write a macro. My objective is to read the color index of a cell and then based on the color index perform some mathematical operations. The color of the cell is based on conditional formatting.

    However when I try to put this statement -> Selection.Interior.ColorIndex , it returns the default color of the cell (and not the color based on the condition).

    Kindly suggest some way out.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Conditional Formatting (Excel 2003 / VBA)

    See Conditional Formatting Colors on Chip Pearson's website.

  3. #3
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (Excel 2003 / VBA)

    Thanks , I got the solution from this site.

  4. #4
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (Excel 2003 / VBA)

    Hi

    There is some issue I am facing. My conditional formatting is based on values in other cells. Due to this the macro does not update the color index value. If I base my conditional formatting based on values in the same cell, it works fine.

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,892
    Thanks
    0
    Thanked 83 Times in 79 Posts

    Re: Conditional Formatting (Excel 2003 / VBA)

    Why not base your calculations on the values of the other cells, rather than on the colours applied due to the values in those cells?
    Regards,
    Rory
    Microsoft MVP - Excel.

  6. #6
    Lounger
    Join Date
    Apr 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Conditional Formatting (Excel 2003 / VBA)

    Actually, its a big worksheet with multiple parameters. Its something like a balance scorecard. There are different parameters with different threshold values for doing the color scheme in terms of Red, Yellow, Green, Blue. So the ranges for the values have been defined in a different column against each parameter. Thats the reason

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,892
    Thanks
    0
    Thanked 83 Times in 79 Posts

    Re: Conditional Formatting (Excel 2003 / VBA)

    I'm not sure what code you have actually used, but do you have an <code>Application.Volatile = True</code> line in it?
    Regards,
    Rory
    Microsoft MVP - Excel.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •