Corregir error en esta macro
Cuando llego al mes de diciembre y tengo que sumar 1 mes más me tiene que tirar enero del año siguiente me tira error, alguien me podar ayudar 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
2 respuestas
Respuesta de Dante Amor
1
Respuesta de Abraham Valencia
