Usuário com melhor resposta
Colocar 4 condições seria possivel?

Pergunta
-
Boa noite!!!
Tenho essa rotina...segue a planilha http://www.4shared.com/file/E6AGRTEt/Relatrio.html
Quero mandar da planilha "Macro" para a planilha "Separação" toda a linha que tenha na coluna "C" 102,107..desde que não tenha na coluna "D" os vazios..até ai tudo funciona mas, quero acresentar o 104
Na parte em negrito quero acrecentar 104...
Como posso fazer? tentei e não deu certo.
Sub Copiar()
Dim kf As Long, ks As Long, kp As Long
Dim i As Long, Qtde As Long
Sheets("Macro").Select
Qtde = [A2].CurrentRegion.Rows.Count
kf = 2
ks = 2
kp = 4
For i = 2 To Qtde
If Sheets("Macro").Cells(i, "D").Value <> "" _
And (Sheets("Macro").Cells(i, "C").Value = 103 _
Or Sheets("Macro").Cells(i, "C").Value = 108) Then
Range(Cells(i, "A"), Cells(i, "N")).Copy Sheets("fracionados").Cells(kf, 1)
kf = kf + 1
End If
Range(Cells(i, "A"), Cells(i, "N")).Copy Sheets("Separação").Cells(ks, 1)
ks = ks + 1
End If
If Sheets("Macro").Cells(i, "D").Value <> "" _
And (Sheets("Macro").Cells(i, "C").Value = 102 _
Or Sheets("Macro").Cells(i, "C").Value = 107) Then
Range(Cells(i, "A"), Cells(i, "N")).Copy Sheets("Separação").Cells(ks, 1)
ks = ks + 1
End If
If Sheets("Macro").Cells(i, "D").Value = "" Then
Range(Cells(i, "A"), Cells(i, "N")).Copy Sheets("vazio").Cells(kp, 1)
kp = kp + 1
End If
Next
MsgBox "Fim de execução da Macro"
End Sub
zinho
Respostas
-
Consegui dessa forma....
If Sheets("Macro").Cells(i, "D").Value <> "" _
And (Sheets("Macro").Cells(i, "C").Value = 102 _Or Sheets("Macro").Cells(i, "C").Value = 104 _
Or Sheets("Macro").Cells(i, "C").Value = 107) Then
Range(Cells(i, "A"), Cells(i, "N")).Copy Sheets("Separação").Cells(ks, 1)
ks = ks + 1
End IfAtt...
zinho- Marcado como Resposta zinhovba sexta-feira, 4 de março de 2011 00:08
Todas as Respostas
-
Boa noite Basta colocar mais um or e a condição como você já esta fazendo If cond1 =1 or cond2 =2 or cond3=3 then Teste ai e qqer coisa fale Att
Bruno Silva Leite
officevb.com -
-
Consegui dessa forma....
If Sheets("Macro").Cells(i, "D").Value <> "" _
And (Sheets("Macro").Cells(i, "C").Value = 102 _Or Sheets("Macro").Cells(i, "C").Value = 104 _
Or Sheets("Macro").Cells(i, "C").Value = 107) Then
Range(Cells(i, "A"), Cells(i, "N")).Copy Sheets("Separação").Cells(ks, 1)
ks = ks + 1
End IfAtt...
zinho- Marcado como Resposta zinhovba sexta-feira, 4 de março de 2011 00:08