Encontrar el error en VBA
He formulado el siguiente código para que se ejecute el macro cada 2 minutos, y si hay un cambio en las celdas 03:O11, me envíe un email con Tabla4. No consigo que funcione, a ver si me podéis echar una mano, please.
Sub CellValueAutoIncr1()
rTime = Now + TimeValue("00:02:00")
Application.OnTime EarliestTime:=rTime, Procedure:="CellValueAutoIncr1", schedule:=True
Application.EnableEvents = False
If IsEmpty(Target) Then
Application.EnableEvents = True
Exit Sub
End If
If Not Intersect(Target, Range("O3:O11")) Is Nothing Then
If IsNumeric(Target) Then
ActiveSheet.Range("Tabla4").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = "[email protected]"
.Item.Subject = "Asunto: Envío rango de Excel por email"
.Introduction = "Ejemplo de rango adjunto con formato..."
.Item.Send
End With
End If
End If
Exit Sub
End Sub