VBA Code:
Sub Entrada()
'
' Entrada Macro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
'Verifica as celulas se estão vazias
If Range("D4") = Empty Then
MsgBox "Medicamento não fornecido!", vbCritical, "Excluir"
Range("D7").Activate
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Exit Sub
End If
If Range("F7") = Empty Then
MsgBox "Lote não fornecido!", vbCritical, "Excluir"
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Exit Sub
End If
If Range("K7") = Empty Then
MsgBox "Quantidade não fornecida!", vbCritical, "Excluir"
Range("K7").Activate
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Exit Sub
End If
If Range("I7") = Empty Then
MsgBox "Forneça um Lugar!", vbCritical, "Excluir"
Range("I7").Activate
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
Exit Sub
End If
...
My code checks if the cells are filled in to register the values correctly. the problem is that it repeats in other lines too, causing the code to be more than 1000 lines long.
Is there any way to optimize this check?
I tried some modifications but without success.