Any wrong in this makro
Sub master2()
Application.ScreenUpdating = False
Dim pair As Variant, accumulator As Variant
Dim findFifteen As Double
Dim remainder As Long, found As Long
found = 1
For Each pair In Range("B30, F30, J30")
' If Right(pair, 1) = 15 Then 'this is wrong
If right(pair,2) =15 then
If pair.Offset(0, 2) <= 12 Then
findFifteen = pair.Offset(0, 2) / 12
remainder = 0
Else
findFifteen = 1
remainder = pair.Offset(0, 2) Mod 12
End If
For Each accumulator In
'??? What this "{a14,b14, not data in your picture
Range("A14, B14, C14, D14, E14, F14, G14, H14, I14, J14, K14, L14")
If accumulator.Offset(-1, 0) = Val(Left(pair, InStr(pair, "-") - 1)) Then
accumulator.Value = accumulator.Value + remainder
End If
accumulator.Value = accumulator.Value + findFifteen
Next accumulator
Range("E" & found).Value = pair
found = found + 1
End If
Next pair
End sub
Bookmarks