Corregir mes siguiente cuando llego a diciembre

Para Adriel Ortiz mangia esta macro me la hiciste vos pero comete un error cuando llego al mes de diciembre y tengo que sumar 1 mes más y me tiene que tirar enero del año siguiente me tira error, me la podrás corregir gracias

Sub Colorear_sumar()
'Act. Aortiz
    For i = 5 To Range("A" & Rows.Count).End(xlUp).Row
        If IsDate(Cells(5, "A")) Then
        '
        fecha1 = Format(Cells(i, "A"), "mm/yyyy")
        año = Year(Date)
        mes = Month(Date) + 1
        '
        fecha2 = Format(CDate(mes & "/" & año), "mm/yyyy")
        '
            If fecha1 = fecha2 Then
                Total = Total + Cells(i, "E")
                Cells(i, "A").Interior.ColorIndex = 6
            Else
                Cells(i, "A").Interior.ColorIndex = xlNone
            End If
        End If
    Next
    Range("F2") = Total
    MsgBox "fin"
End Sub

Añade tu respuesta

Haz clic para o