Não sabia que título colocar, então é o que tinha para hoje.
Minha dúvida é a seguinte:
Como anexado, existem essas três colunas.
Queria que quando eu colocasse para um certo "cargo", ele recebesse no e-mail todas as pessoas que são do setor dele, empresa e etc..
Eu tenho isso no meu código (para criar o email):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim OutApp As Object
Dim OutMail As Object
Dim texto As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
linha = ActiveCell.Row - 1
If Target.Address = "$F$" & linha Then
If Plan1.Cells(linha, 6) = "PM" Then
texto = "Prezado " & Plan1.Cells(linha, 2) & "," & vbCrLf & vbCrLf & _
"Sua designação para esse mês é: " & Plan1.Cells(linha, 3) & " " & vbCrLf & _
"Seus empregados são: TRAZER TODOS OS QUE TEM OS MESMOS VALORES NA COLUNA DE EMPRESA" & vbCrLf & _
"Atenciosamente," & vbCrLf & _
"A Diretoria." 'FINALIZADO
End If
With OutMail
.To = Plan1.Cells(linha, 1)
.CC = ""
.BCC = ""
.Subject = "Transferência"
.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
Deu para entender?
Desde já agradeço, gostaria muito de acrescentar essa regra para a planilha.
Obrigado!
EXEMPLO.xlsx