I have a macro comparing the value of two cells next to each other but 39.99 is being rounded up to 40 and 33.17 rounded down to 33.
I have no idea why or how to cure it, please can you advise?
Below is my code and it is Excel 2007
thank you
Dim rt As String ' number of times
Dim ev As Integer
Dim rv As Integer
Sub loss()
Range("B7").Activate
Do Until ActiveCell.Value = ""
If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, 3).Activate 'across 3
ev = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
rv = ActiveCell.Value
ActiveCell.Offset(1, -4).Activate
Else
ActiveCell.Offset(1, 0).Select 'down 1 across 0
GoTo nxt
End If
If ev > rv Then
rt = rt + 1
ev = "0"
rv = "0"
MsgBox ("ev greater then rv")
End If
nxt:
Loop
End Sub
I have no idea why or how to cure it, please can you advise?
Below is my code and it is Excel 2007
thank you
Dim rt As String ' number of times
Dim ev As Integer
Dim rv As Integer
Sub loss()
Range("B7").Activate
Do Until ActiveCell.Value = ""
If ActiveCell.Value = 1 Then
ActiveCell.Offset(0, 3).Activate 'across 3
ev = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
rv = ActiveCell.Value
ActiveCell.Offset(1, -4).Activate
Else
ActiveCell.Offset(1, 0).Select 'down 1 across 0
GoTo nxt
End If
If ev > rv Then
rt = rt + 1
ev = "0"
rv = "0"
MsgBox ("ev greater then rv")
End If
nxt:
Loop
End Sub