Copy data from one column (B) to another sheet if the condition of the column (F) is met. excel

I have tried and continue to try several codes to automate the copying of data (column B, proposals sheet) to another (projects) sheet, also in Column B, if Column F of the "proposals" sheet contains the terms "accepted" or "submitted".

Both sheets are in the same format. Table header in B3: J3 and data start in B4: Jx

Could anyone give a light?

Author: Paola Zaninelli, 2018-05-16

1 answers

You can try the following code, which checks the contents of Column F of the "proposals" sheet and if it is equal to" accepted " or "submitted", copies the value of Column B of the" proposals "sheet to Column B of the"projects" sheet. This code stops running when the value in Column B of the "proposals" sheet is blank.

Dim i As Long
Dim j As Long

i = 4
j = 4

While (Worksheets("proposals").Cells(i, 2) <> "")
    If (Worksheets("proposals").Cells(i, 6) = "Aceita" Or Worksheets("proposals").Cells(i, 6) = "Enviada") Then
        Worksheets("projects").Cells(j, 2) = Worksheets("proposals").Cells(i, 2)
        j = j + 1
    End If
    i = i + 1
Wend
 1
Author: Renata, 2018-05-16 17:23:30