Conditional formatting with Iserror

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • loudey
    New Member
    • Mar 2010
    • 20

    #1

    Conditional formatting with Iserror

    I'm trying to change the background color of cell B15 to red if any of the following cells is an error M15, O15, Q15, or S15. I know i can do it with conditional formatting but conditional formatting does not let you include more than three criteria. if your solution involves a macro do not worry about triggring the macro because i can embed it within a macro that i currently have and it gets automatically triggered whenver the cell changes. so all i'm worried about is how to have the macro check if any of those cells is an error and then change the background color of B15 to red.
  • patjones
    Recognized Expert Contributor
    • Jun 2007
    • 931

    #2
    Try pasting this into a VBA window and compiling. You can run it as a macro.

    Code:
    Public Sub ChangeColor()
    
    If IsError(Sheet1.Cells(15, 13)) Or IsError(Sheet1.Cells(15, 15)) Or IsError(Sheet1.Cells(15, 17)) Or IsError(Sheet1.Cells(15, 19)) Then
        Sheet1.Cells(15, 2).Interior.Color = RGB(255, 0, 0)
    Else
        Sheet1.Cells(15, 2).Interior.Color = RGB(255, 255, 255)
    End If
    
    End Sub

    Pat

    Comment

    • loudey
      New Member
      • Mar 2010
      • 20

      #3
      thanks Pat this works exactly like i wanted

      highly appreciated
      Loudey

      Comment

      Working...