Hi

I have a macro that is not searching a cell range properly. If someone could kindly assist. Please see my Excel image.

Example with expected result.

The first part of the macro works fine it’s the last part that is not working correctly. As per my Excel image cell B30 has the number 7-15 in it. I need the macro to go to the cell below B31 and use that number (1 in this example) and search the following cell range: E1:E12 to find a 1 (cell E1). Once found place the 7-15 and increase the last digit by 1 (so it becomes 7-16) in the adjacent cell to the right (F1). Do the same with all cells: B30, F30 and J30 but only if they contain a 15 (1-15 or 7-15 etc.) as the last number. After this delete all contents in cell B30, C30, D30. There are are two examples in my Excel sheet.

Thank-you in advance for your assistance.

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
        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 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

Application.ScreenUpdating = True
End Sub
EXCEL IMAGE.JPEG