I am using the following code to run through up to 100 locations and create a result in column E. Initially this worked fine, but now it is rounding numbers. For example in column B, I may have a value of 175.61 and in column C a value of 350.00. I am trying to subtract column B from column C and get the results of 174.39 that is posted in column E. However, the result in rounding the number to just 174.00 not showing the remainder in column E.
My code is
Sub SetReportValues()
Dim cellNum, j, cvalue As Integer
Dim myColumn1, myColumn2 As String
cellNum = 6
Sheets("ExpenseSummary").Activate
Unprotect
myColumn1 = "C"
myColumn2 = "B"
For j = 1 To 100
If Range("C" & cellNum) = "No" Then
Range("E" & cellNum).Formula = ""
ElseIf Range("A" & cellNum) <> "" Then
cvalue = Range(myColumn1 & cellNum).Value - Range(myColumn2 & cellNum).Value
Range("E" & cellNum).Value = cvalue
End If
cellNum = cellNum + 1
Next j
Protect
End Sub
Any idea how I can stop this? Column E is formated with 2 decimal places.
Bookmarks