I want to go through column D and if there is a "Yes" copy a number of cells that are constantly the same distance away from the cell in Column D that says "Yes".
For example if D23 says "Yes" then copy A23, A24, B22, and E22 side by side in a another sheet.
I recorded the code below. I attached the macro to a button. If I scroll to a cell in Column D that has "Yes" and click the button it does what I want. I don't know how to make it run the code on it's own through the entirety of column D.
Additionally it pastes on the side of the information. Is there a way to paste in a new sheet below the previous pasted data because currently there's a lot of empty space between the rows since the "yes" is only present every 20 rows or so.
Sub Test()
' Test Macro
Range("A23").Select
Selection.Copy
Range("V23").Select
ActiveSheet.Paste
Range("A24").Select
Application.CutCopyMode = False
Selection.Copy
Range("W23").Select
ActiveSheet.Paste
Range("B22").Select
Application.CutCopyMode = False
Selection.Copy
Range("Y23").Select
ActiveSheet.Paste
Range("E22").Select
Application.CutCopyMode = False
Selection.Copy
Range("Z23").Select
ActiveSheet.Paste
End Sub