Inquiridor
IF COM MAIS DE 3 CONDIÇÕES

Pergunta
-
estou tentando fazer um código que atenda o seguinte:
se o "PLANO" for diferente de particular (coluna 4) e se o campo "PROCEDIMENTO(S)" (coluna 6) diferente de vazio, preencha o campo "F.PGTO" com "Plano".
Esse código deve sempre ser executado a cada vez que uma célula da coluna 4 e 6 for alterada.
Tentei fazer este, mas não roda com todas as condições:
If Target.Column = 4 And Cells(Target.Row, 4).Value <> "PARTICULAR" And Target.Column = 6 And Cells(Target.Row, 6).Value <> "" Then
Cells(Target.Row, 10).Value = "PLANO"
End IfSou iniciante, mas amo excel.
Todas as Respostas
-
If Target.Column = 4 Then If Cells(Target.Row, 4).Value <> "PARTICULAR" Then If Target.Column = 6 Then If Cells(Target.Row, 6).Value <> "" Then Cells(Target.Row, 10).Value = "PLANO" End If End If End If End If
Anderson Diniz
- Sugerido como Resposta AndersonFDiniz2 terça-feira, 18 de julho de 2017 22:07
-
Se não funcionar, envie o código completo.
Anderson Diniz
- Sugerido como Resposta AndersonFDiniz2 terça-feira, 18 de julho de 2017 22:09
-
Dim cl As Object For Each cl In ThisWorkbook.Sheets("Planilha1").UsedRange.Cells If cl.Column = 4 Then If cl.Row = target.Row Then If cl.Value <> "PARTICULAR" Then If ThisWorkbook.Sheets("Planilha1").Cells(cl.Row, 6).Value <> "" Then ThisWorkbook.Sheets("Planilha1").Cells(cl.Row, 10).Value = "PLANO" Exit For End If End If End If End If Next cl
Anderson Diniz
- Sugerido como Resposta AndersonFDiniz2 terça-feira, 18 de julho de 2017 22:30