VBA code for filtering data to another sheet

rstabor07

New Member
Joined
Sep 22, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have a code im writing to filter any data from a table on a specific sheet and if it finds that data, then to paste it onto another worksheet. I have it working, however its only selecting one instance of the filter. I want it to transfer as many instances of the filter that it finds. I also want it to only paste unique entries, as to not delete anything on the second worksheet. Can you help?

Public Sub CopyOverBudgetRecords()

Dim StatusCol As Range
Dim Status As Range
Dim PasteRow As Range

Set StatusCol = Sheet2.Range("F11:F500")
For Each Status In StatusCol

If Sheet3.Range("A10") = "Jessica Bullitt" Then
Set PasteRow = Sheet3.Range("A10")
Else
Set PasteRow = Sheet3.Range("A9").End(xlDown).Offset(1, 0)
End If

If Status = "Jessica Bullitt" Then Status.EntireRow.Copy PasteRow


Next Status

End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top