Assuming its a typo at your end, use this code where Sender uses Sendside and Payee uses Payside sheets -
Option Explicit
Sub copy_data()
Dim i As Long, lrow As Long, lrow1 As Long, lrow2 As Long
Dim rngcopy As Range
Application.ScreenUpdating = False
With Worksheets("Fill Out This Form")
lrow = .Range("E" & .Rows.Count).End(xlUp).Row
lrow1 = Worksheets("Sendside").Range("A" & Rows.Count).End(xlUp).Row
lrow2 = Worksheets("Payside").Range("A" & Rows.Count).End(xlUp).Row
For i = 3 To lrow
If .Range("E" & i).Value = "Sender" Then
Worksheets("SendSide").Range("A1:H" & lrow1).AutoFilter field:=1, Criteria1:=.Range("L" & i).Value
Set rngcopy = Worksheets("SendSide").Range("A2:H" & lrow1).SpecialCells(xlCellTypeVisible)
rngcopy.Copy Worksheets("Subjects").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Set rngcopy = Nothing
ElseIf .Range("E" & i).Value = "Payee" Then
Worksheets("PaySide").Range("A1:H" & lrow2).AutoFilter field:=1, Criteria1:=.Range("L" & i).Value
Set rngcopy = Worksheets("PaySide").Range("A2:H" & lrow2).SpecialCells(xlCellTypeVisible)
rngcopy.Copy Worksheets("Subjects").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
Set rngcopy = Nothing
End If
Next i
End With
Worksheets("SendSide").Rows(1).AutoFilter
Worksheets("PaySide").Rows(1).AutoFilter
MsgBox "Done"
Application.ScreenUpdating = True
End Sub
Copy the Excel VBA code
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
Bookmarks