J
JDaniel1127
Trying to change a row color based on the subtraction of 2 cells
Have the following code as a macro on an update button:
Sub Update_Row_Colors()
Dim LRow As Integer
Dim LCell As String
Dim LColorCells As String
'Start at row 2
LRow = 2
SCell = 1
'Update row colors for the first 2000 rows
While LRow < 2000
LCell = "H" & LRow
'Color will changed in columns A to G
LColorCells = "A" & LRow & ":" & "G" & LRow
'Color set to Red or Green
If Left(Range(LCell).Value, 6) >= 0 Then
Range(LColorCells).Interior.ColorIndex = 4
Range(LColorCells).Interior.Pattern = xlSolid
Else
Range(LColorCells).Interior.ColorIndex = 3
End If
If Left(Range(LCell).Value, 6) = "" Then
Rows(LRow & ":" & LRow).Select
Range(LColorCells).Interior.ColorIndex = xlNone
End If
LRow = LRow + 1
Wend
Range("A1").Select
End Sub
The sheet I am working with has column H as the sum(d3-e3) throug
sum(d100-e100. The problem is when the H column value is #value! i
stops with a runtime error '13' type mismatch. How do I fix that
Have the following code as a macro on an update button:
Sub Update_Row_Colors()
Dim LRow As Integer
Dim LCell As String
Dim LColorCells As String
'Start at row 2
LRow = 2
SCell = 1
'Update row colors for the first 2000 rows
While LRow < 2000
LCell = "H" & LRow
'Color will changed in columns A to G
LColorCells = "A" & LRow & ":" & "G" & LRow
'Color set to Red or Green
If Left(Range(LCell).Value, 6) >= 0 Then
Range(LColorCells).Interior.ColorIndex = 4
Range(LColorCells).Interior.Pattern = xlSolid
Else
Range(LColorCells).Interior.ColorIndex = 3
End If
If Left(Range(LCell).Value, 6) = "" Then
Rows(LRow & ":" & LRow).Select
Range(LColorCells).Interior.ColorIndex = xlNone
End If
LRow = LRow + 1
Wend
Range("A1").Select
End Sub
The sheet I am working with has column H as the sum(d3-e3) throug
sum(d100-e100. The problem is when the H column value is #value! i
stops with a runtime error '13' type mismatch. How do I fix that