Boa Tarde,
Estou criando uma Macro que me ajuda com o controle de estoque,
quero que quando cada objeto estiver com a quantidade <= 2 me mande um e-mail de alerta...
tentei esse código porem ele envia alerta quando altera qualquer celular e nem verifica o valor que especifiquei.
segue o código:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OutApp As Object
Dim OutMail As Object
Dim texto As String
Dim endereco As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
linha = ActiveCell.Row - 1
If Target.Address = "$C$" & linha Then
If Plan2.Cells(linha, 3) = 2 Then
texto = "Prestar Aten??o"
End If
With OutMail
.To = "alef.sousa@bbquimica.com.br"
.CC = ""
.BCC = ""
.Subject = "Fornecimento de material"
'.HTMLBody = texto
.Body = texto
.Display 'Utilize Send para enviar o email sem abrir o Outlook
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub