Preciso preencher automaticamente uma célula com base no fato de 2 células conterem valores específicos e, em seguida, executá-la automaticamente. Isto é o que eu tenho até agora:
Private Sub Worksheet_Change(ByVal Target As Range)
If target.Cells(5, "B").Value = "Secured" And target.Cells(6, "B").Value = "Amendment" Then
Cells(10, "B") = "T2 - Medium Risk"
End If
End Sub
A instrução if seria, =IF(AND(D34="Secured",D35="Amendment"),"yes","")
mas o "sim" precisa estar em uma célula diferente
Responder1
Isto é o que você está procurando
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B5:B6")) Is Nothing Then
If Cells(5, 2) = "Secured" And Cells(6, 2) = "Amendment" Then
Cells(10, 2) = "T2 - Medium Risk"
End If
End If
End Sub
Você deseja que ele seja acionado quando a alteração estiver dentro dessas duas células e, se elas corresponderem, preencha uma célula diferente. Se quiser apagá-lo, você também pode fazer isso.