vendredi 6 mars 2020

Trying to Copy column and paste into another sheet based on another cells value VBA

I am trying to copy the content of a column only if another cell equals "Yes". If the cell equals "Yes", I want to paste the selected columns range into another workbook. Then loop to the next "Yes".

    If M2 = "Yes" then copy AD2:AD200 if "NO" go to the next "if"
    If M3 = "Yes" then copy AE2:AE200 if "NO" go to the next "if"
    If M4 = "Yes" then copy AF2:AF200 if "NO" go to the next "if" 

and so on....

The last one i will look for is M11.

Then paste the copy range to last blank cell in sheet "Cases in QA Status",

    range("AL200",range("al200").end(xlUp).select

This is what I have so far:

    Sheets("Sheet1").Select
    If Range("M8").Value = True Then
    Range("aj2:aj200").Select
    Selection.Copy
    Sheets("Cases in QA Status").Select
    End If
    End Sub

Aucun commentaire:

Enregistrer un commentaire