I have the code:
Sub ThresholdFormatting()
ThisWorkbook.Worksheets("Calculations").Activate
Dim i As Integer, m As Integer
For m = 3 To 28
For i = 6 To 10
If Cells(i, m).Value / Worksheets(1).Cells(i, m).Value > Cells(8, 39).Value Then
Cells(i, m).Font.Color = -16776961
Cells(i, m).TintAndShade = 0
Cells(i, m).Interior.Pattern = xlSolid
Cells(i, m).PatternColorIndex = xlAutomatic
Cells(i, m).ThemeColor = xlThemeColorAccent2
Cells(i, m).TintAndShade = 0.599993896298105
Cells(i, m).PatternTintAndShade = 0
End If
Next i
Next m
End Sub
Every time I run this Code the Error 6: Overflow comes up highlighting the start of the If statement. I have run this code without the contents of the If statement and still get the same error. My issue is that I am trying to manually conditional format based on the set criteria above. The if statement formula should check to see if the cell i am referencing divided by a cell in another worksheet is less than the cell 8, 39 which is a variable Threshold.
Thanks,
Sub ThresholdFormatting()
ThisWorkbook.Worksheets("Calculations").Activate
Dim i As Integer, m As Integer
For m = 3 To 28
For i = 6 To 10
If Cells(i, m).Value / Worksheets(1).Cells(i, m).Value > Cells(8, 39).Value Then
Cells(i, m).Font.Color = -16776961
Cells(i, m).TintAndShade = 0
Cells(i, m).Interior.Pattern = xlSolid
Cells(i, m).PatternColorIndex = xlAutomatic
Cells(i, m).ThemeColor = xlThemeColorAccent2
Cells(i, m).TintAndShade = 0.599993896298105
Cells(i, m).PatternTintAndShade = 0
End If
Next i
Next m
End Sub
Every time I run this Code the Error 6: Overflow comes up highlighting the start of the If statement. I have run this code without the contents of the If statement and still get the same error. My issue is that I am trying to manually conditional format based on the set criteria above. The if statement formula should check to see if the cell i am referencing divided by a cell in another worksheet is less than the cell 8, 39 which is a variable Threshold.
Thanks,