Hi All,
The code below reviews each row and returns "ERROR" in column P if the sum of the MONTHS does not equal the hard number stated in YTD; if the numbers match the code just moves on to the next row for evaluation.
The code works perfectly EXCEPT when the sum total and the YTD ends with .50...urg!!! ANY IDEAS ON HOW TO FIX THIS???
<tbody>
</tbody>
'To review each row for data errors
Do While ActiveCell.Offset(0, -11).Value > 0
YTD = ActiveCell.Offset(0, -2)
Fx = Application.WorksheetFunction.Sum(ActiveCell.Offset(0, -7), ActiveCell.Offset(0, -6), ActiveCell.Offset(0, -5), ActiveCell.Offset(0, -4), ActiveCell.Offset(0, -3))
If Fx = YTD Then
ActiveCell.Offset(1, 0).Select
Else
Range("P1").FormulaR1C1 = "Error Check"
ActiveCell.FormulaR1C1 = "ERROR"
ActiveCell.Offset(1, 0).Select
End If
Loop
The code below reviews each row and returns "ERROR" in column P if the sum of the MONTHS does not equal the hard number stated in YTD; if the numbers match the code just moves on to the next row for evaluation.
The code works perfectly EXCEPT when the sum total and the YTD ends with .50...urg!!! ANY IDEAS ON HOW TO FIX THIS???
OFFSET | -15 | -14 | -13 | -12 | -11 | -10 | -9 | -8 | -7 | -6 | -5 | -4 | -3 | -2 | -1 | ACTIVECELL |
COLUMN | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
Business Unit | Fund | Department | Major | Account | Title | FY16 | FY17 | JUL | AUG | SEP | OCT | NOV | YTD | BUDGET | Error Check | |
95720 | 01000 | 857 | 11 | 5012489 | Expense | 59,803.08 | 62,734.25 | 8,001.36 | 5,456.20 | 5,456.20 | 5,459.90 | 5,615.84 | 29,989.50 | 70,951.00 | ERROR |
<tbody>
</tbody>
'To review each row for data errors
Do While ActiveCell.Offset(0, -11).Value > 0
YTD = ActiveCell.Offset(0, -2)
Fx = Application.WorksheetFunction.Sum(ActiveCell.Offset(0, -7), ActiveCell.Offset(0, -6), ActiveCell.Offset(0, -5), ActiveCell.Offset(0, -4), ActiveCell.Offset(0, -3))
If Fx = YTD Then
ActiveCell.Offset(1, 0).Select
Else
Range("P1").FormulaR1C1 = "Error Check"
ActiveCell.FormulaR1C1 = "ERROR"
ActiveCell.Offset(1, 0).Select
End If
Loop