Copy based on two variables

proctk

Well-known Member
Joined
Dec 24, 2004
Messages
840
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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
I tried manythings based on the attached recomendations but no luck, can someone please post an example
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

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