/ / Excel / Mover automaticamente linha completa para outra planilha - excel, excel-vba, vba

Excel / Mover automaticamente linha completa para outra folha - excel, excel-vba, vba

Eu preciso editar uma planilha do Excel para que uma linhamove-se automaticamente de uma folha ("Open_Followups") para outra folha ("Closed_Followups") se contiver "Yes" na coluna "I" ("Event completed / closed").

Eu não tenho experiência em VBA e queria saber se alguém aqui poderia me ajudar a criar o código?

Captura de tela das primeiras colunas na folha.

captura de tela

Não tenho certeza se é importante, mas estou usando o Excel 2016 em um computador Mac

Respostas:

0 para resposta № 1

Eu escrevi um pequeno script para você (no MS Excel)que procura um "y" na linha B e, se encontrar uma correspondência, copia o valor da linha A para a planilha "Tabelle2". Este é apenas um exemplo (eu não estou aqui para fazer o seu trabalho para você;)) Brinque com ele e importe-o em sua pasta de trabalho e ajuste-o onde for necessário.

Private Sub CommandButton1_Click()

Dim LastRow As Long
Dim LastRow2 As Long
Dim counter As Integer

"get the last row in this sheet (column A)
With ActiveSheet
LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
End With

"get the last row in the sheet "Tabelle2" (column A)
With Sheets("Tabelle2")
LastRow2 = .Cells(.Rows.Count, 1).End(xlUp).Row
End With

"the counter is needed to add dynamically to "Tabelle2"
counter = LastRow2 + 1
"run from 1 to the last row in your first sheet
For i = 1 To LastRow
"search for matches
If Cells(i, 2).Text = "y" Then
"if found, write to "Tabelle2"
Sheets("Tabelle2").Cells(counter, 1).Value = Cells(i, 2).Offset(0, -1).Value
counter = counter + 1
End If
Next

End Sub