Ongoing and interactive Filtering

KGEORGE13

New Member
Joined
May 30, 2018
Messages
36
When a certain word or set of text is entered into a column in my table, I want that entire row to be copied and placed on another sheet in the workbook. Say you"re inputing food orders into an excel table. You want all the orders to be on one sheet entirely, but every time someone orders a cheeseburger or a hamburger, you want that order to be copied onto another sheet. I've tried VBA code using a filter criteria, but it doesn't run. Maybe because I have roughly 100 criteria (cheeseburger, hamburger, etc.)

PLEASE HELP!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
So in what column are you entering these values.

So if you enter Hamburger in column A you want that entire row copied to sheet 2 is that correct?

We need the name of both sheets.
And what words if entered in column A would cause this entire row to be copied to sheet 2?
 
Upvote 0
All orders will be entered in sheet called "Orders".
When "Hamburger" or "Cheeseburger" is entered in Column A, I want all of those rows containing those words to be copied onto sheet named "Burgers"
Only the rows containing those words copied and I want the copied sheet (Burgers) to be in order by date, which will be entered in the table.

Thank you!
 
Upvote 0
I was assuming you wanted this done immediately when the order was placed.
So here is my solution.

On sheet named Orders put the below code

Now when you fill in the row with all the data needed for that order.
Double click on column A of that row.
Now if you have Hamburger or
Cheeseburger
in column A that row of data will be copied to sheet named Burgers

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified 5/30/18 3:30 PM EDT
If Not Intersect(Target, Range("A:A")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Cancel = True
Dim Lastrow As Long
Dim r As Long
r = Target.Row
Lastrow = Sheets("Burgers").Cells(Rows.Count, "A").End(xlUp).Row + 1
If Target.Value = "Hamburger" Or Target.Value = "Cheeseburger" Then
Rows(r).Copy Sheets("Burgers").Rows(Lastrow)
End If
End If
End Sub
 
Last edited:
Upvote 0
Thank you!

I was looking for a general VBA code, But I should have been more specific. The order entry spreadsheet I am working with is giant. I need to filter out roughly 100 part numbers from a column that can contain 1000 different part numbers and then copy them to another sheet. I do need this to happen immediately every time a new order is placed. The orders are all placed in sheet: "ORDERS" and filtered and copied to sheet: "PARTS".

I know this is tough with 100 different criteria, but if you have any ideas it would be appreciated!
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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