Forum Discussion

JB_SE_ED's avatar
JB_SE_ED
Copper Contributor
Feb 27, 2023
Solved

Need help with a VBA Macro for copying and pasting of rows.

Hello,    My experience is fairly limited with Macro's, and even more so with VBA code (so please feel free to be as specific as possible). But I am building an automation flow that uses macro's in...
  • HansVogelaar's avatar
    HansVogelaar
    Feb 27, 2023

    JB_SE_ED 

    Thank you, I downloaded the workbook. Try this version:

    Sub Sample()
        Dim LastRow As Long
        LastRow = Range("A" & Rows.Count).End(xlUp).Row
        Range("F1:F" & LastRow).AutoFilter Field:=1, Criteria1:="2"
        Range("A2:F" & LastRow).Copy Destination:=Range("A" & LastRow + 1)
        Range("F1:F" & LastRow).AutoFilter Field:=1
    End Sub

Resources