Do not modify cell for given result. (History)

1

In a management table I have two columns one Status(Coluna A) and another Estado Anterior status . In this I want to save the same value as in column A, except for some cases. So it saves a history of status when it is concluído

Ex:

 Status                    Estado Anterior Status
 Em contato                Em contato

In case it does not change

Status                    Estado Anterior Status
Concluído                 Em contato

Ps: I've looked for several code, but can not execute it perfectly.

    
asked by anonymous 07.05.2016 / 16:18

2 answers

1

After clicking on the worksheet I was working on (in the lower left corner) and selecting the option exibir código I put the following code

Private Sub Worksheet_Change(ByVal Target As Range)
    'Verifica se esta na coluna A'
     If Not Application.Intersect(Range("A:A"), Range(Target.Address)) Is Nothing Then
     'Verifica se é diferentes desses valores
        If Target.Text <> "Concluído" And Target.Text <> "Cancelado" And Target.Text <> "Pausado" Then
            Cells(ActiveCell.Row, "E") = Target
        End If
     End If
End Sub
    
10.05.2016 / 01:06
1

Victor, with the code below the corresponding cell in column B, will only receive the updated value of Column A if Column A does not contain the word "Completed."

Dim i, Linha_inicial, Linha_final, Coluna As Integer 

Linha_inicial = 10 'Linha inicial dos dados a atualizar na Coluna B
Linha_final = 80 'Linha final dos dados a atualizar na Coluna B

Coluna = 1 '(valor para a Coluna A)

For i = Linha_inicial to Linha_final

 'Se a Coluna A não tem a palavra "Concluído"
 If Cells(i, Coluna) <> "Concluído" then

  'a linha i da Coluna B recebe o valor que está na coluna A                                                                        
  Cells(i, Coluna + 1) = Cells(i, Coluna)  'Coluna + 1 é a Coluna B (=2)

 End if

Next i 
    
08.05.2016 / 03:46