Copy based on two variables

proctk

Well-known Member
Joined
Dec 24, 2004
Messages
839
Hi

I have a database that I want to copy the entire row to another worksheet if the values in two rows match the values in a sheet called “switch in” cells B2 & B3. The first sheet is called “datalist” and the rows that I’m trying to match are rows 1 and 3

The data needs to be copied to the sheet called “Switch In” starting at row 5

The value in row 1 is a date, so if the date land within the month in Cell B2 and the value in Row 3 matched the value in cell B3 then the entire row needs to be copied.
Thank you

I don't know were to start
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

NateO

Legend
Joined
Feb 17, 2002
Messages
9,700
Try turning on your macro recorder, and using an autofilter of for your criteria. Copy the filtered data.

Go back to the code and make the criteria variable, based on your range. E.g., instead of:

Criteria1:=">=0.2"

You'd want:

Criteria1:=">=" & sheets("switch in").range("b2").value

Cross posted:
http://www.xtremevbtalk.com/showthread.php?t=213654
 

proctk

Well-known Member
Joined
Dec 24, 2004
Messages
839
I tried manythings based on the attached recomendations but no luck, can someone please post an example
 

Watch MrExcel Video

Forum statistics

Threads
1,122,464
Messages
5,596,288
Members
414,052
Latest member
Dual Showman

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
Top