I am using the below code to automate copy and pasting to another sheet. However i do not want to copy the entire row- only the row from column AA. Please help.
I have tried using .range instead of .rows but this is bringing unwanted results. .range("AA5:AZ5") - this pastes the contents far more times than required and also means i have to define the end of the data each time
a = Worksheets("Reference Sheet").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Worksheets("Reference Sheet").Cells(i, 40).Value = "Private Standard" Then
Worksheets("Reference Sheet").Rows(i).Copy
Worksheets("Private Sheet").Activate
b = Worksheets("Private Sheet").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Private Sheet").Cells(b + 1, 1).Select
ActiveSheet.Paste
Worksheets("Reference Sheet").Activate