Copy, Paste paste vba

1

Good evening, I need to filter the data in column B that contains "Cell 01"  I have some comments to make in the project.

I need to copy the entire worksheet and paste it into a new file.

2- Keep the formulas in it.

What can I use?

Follow the image

Thank you

    
asked by anonymous 24.05.2018 / 19:20

1 answer

4

You can iterate the lines using a

For cont = Plan.UsedRange.Rows.Count To 1 Step -1
'Plan é a referência à planilha; cont é uma variável do tipo long.
'Recomendo fazer em ordem decrescente porque em ordem crescente, quando você
'exclui uma linha o excel remunera todas as seguintes para uma a menos, daí o código
'termina indiretamente pulando a próxima linha.

To test the contents of column 2 and delete the respective row, you can use

If Plan.Cells(cont, 2).Formula = "Cell 01" Then Plan.Rows(cont).Delete

To copy the worksheet, the statement is

plan.Copy

I kind of finished giving you the code almost complete, but remember that StackOverflow is not a code-creation service, but to ask questions and ask for clarification. So in the next few questions, remember to have some code as a starting point, of which you have questions.

    
25.05.2018 / 04:43