Hi I have a macro that compares the increasing values in Col A and writes the difference in value of these compared to the first value in Col A in Col B. This works fine as long as the first number is a whole number. If not it just rounds it up or down. I need it to give me the answer to two decimal places. Heres the code
'Setup
Dim r As Range
Dim n As Integer, a As Integer
'End
'Initialize 'offset' countr 'n'
n = 1
'Get start value as 'a'
a = Selection
'Get start address (range) as 'r'
Set r = Selection
'B1 = A1 - A1
r.Offset(0, 1) = a - a
'B2 = A2-A1, B3=A3-A1, Bx=Ax-A1 until Ax is less than A1 (end of list)
Do While r.Offset(n, 0).Value > a
r.Offset(n, 1) = r.Offset(n, 0).Value - a
n = n + 1
Loop
End Sub
Any help with this would be great
John
Bookmarks