Boa Noite
como resolvo este erro desta formula, o erro esta em negrito
If CDate(Cells(a, "A")) = Dia Then
Function retornaDiaMesEAno(ByVal Dia As Date, ByVal Mes As String, ByVal Ano As Integer)
somaVendasDia = "0"
somaVendasMes = "0"
somaVendasAno = "0"
somaComprasDia = "0"
somaComprasMes = "0"
somaComprasAno = "0"
somaPrazoDia = "0"
somaPrazoMes = "0"
somaPrazoAno = "0"
Application.ScreenUpdating = False
With ThisWorkbook.Sheets("Compras")
.Activate
For A = 4 To .UsedRange.Rows.Count
If Cells(A, "A") <> "" Then
Cells(A, "A").Select
If CDate(Cells(A, "A")) = Dia Then
somaComprasDia = somaComprasDia + CDbl(Format(Cells(A, "E"), "currency"))
End If
If Mid(Cells(A, "A"), 4, 2) = Mes Then
somaComprasMes = somaComprasMes + CDbl(Format(Cells(A, "E"), "currency"))
If Mid(Cells(A, "A"), 7, 4) = Ano Then
somaComprasAno = somaComprasAno + CDbl(Format(Cells(A, "E"), "currency"))
End If
End If
End If
Next
End With
With ThisWorkbook.Sheets("Vendas")
.Activate
For A = 4 To .UsedRange.Rows.Count
Cells(A, "A").Select
If Cells(A, "A") <> "" Then
If CDate(Cells(A, "A")) = Dia Then
somaVendasDia = somaVendasDia + CDbl(Format(Cells(A, "E"), "currency"))
End If
If Mid(Cells(A, "A"), 4, 2) = Mes Then
somaVendasMes = somaVendasMes + CDbl(Format(Cells(A, "E"), "currency"))
If Mid(Cells(A, "A"), 7, 4) = Ano Then
somaVendasAno = somaVendasAno + CDbl(Format(Cells(A, "E"), "currency"))
End If
End If
End If
Next
End With
With ThisWorkbook.Sheets("Prazo")
.Activate
For A = 4 To .UsedRange.Rows.Count
Cells(A, "A").Select
If Cells(A, "A") <> "" Then
If CDate(Cells(A, "A")) = Dia Then
somaPrazoDia = somaPrazoDia + CDbl(Format(Cells(A, "E"), "currency"))
End If
If Mid(Cells(A, "A"), 4, 2) = Mes Then
somaPrazoMes = somaPrazoMes + CDbl(Format(Cells(A, "E"), "currency"))
If Mid(Cells(A, "A"), 7, 4) = Ano Then
somaPrazoAno = somaPrazoAno + CDbl(Format(Cells(A, "E"), "currency"))
End If
End If
End If
Next
End With
ThisWorkbook.Sheets("Menu").Activate
Application.ScreenUpdating = True
End Function
Postado : 07/06/2017 8:41 pm