Notifications
Clear all

Dúvida Worksheets(

4 Posts
2 Usuários
0 Reactions
1,120 Visualizações
(@juniorrr)
Posts: 6
Active Member
Topic starter
 

Desculpem pela pergunta que talvez seja até meio que idiota mas estou iniciando no mundo do VBA e EXCEL avançado.

Tenho uma "condição" na planilha que está funcionando perfeitamente, e consegui graças a ajuda de membro aqui no forum, no qual sou muito agradecido.
a minha dúvida é a seguinte, como eu faço para criar outra condição na mesma planilha? (Plan1) Pode ser a mesma Worksheet que criei porem indicando celulas diferentes.

segue minha macro:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = Range("B3:B99").Column Then
Sheets("Plan1").Cells(Target.Row, "C") = Sheets("Plan1").Cells(Target.Row, "B") + Sheets("Plan1").Cells(Target.Row, "C")

End If
End Sub

Quero fazer esta mesma macro para as colunas D e E na mesma planilha, (plan1)/

 
Postado : 11/08/2015 8:00 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43661
Illustrious Member
 

Bom dia!!

Eu não sei se entendi perfeitamente, também não testei!!

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = Range("B3:B99").Column Then
        Sheets("Plan1").Cells(Target.Row, "C") = Sheets("Plan1").Cells(Target.Row, "B") + Sheets("Plan1").Cells(Target.Row, "C")
    End If
    
    If Target.Column = Range("D3:D99").Column Then
        Sheets("Plan1").Cells(Target.Row, "E") = Sheets("Plan1").Cells(Target.Row, "D") + Sheets("Plan1").Cells(Target.Row, "E")
    End If
    
End Sub

Att

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 12/08/2015 6:32 am
(@juniorrr)
Posts: 6
Active Member
Topic starter
 

Era exatamente isso...

 
Postado : 12/08/2015 6:57 am
(@juniorrr)
Posts: 6
Active Member
Topic starter
 

Muito bom pessoal, muito obrigado mesmo! funcionou.

 
Postado : 12/08/2015 8:47 am