add a line of code using zn if statement or between

daniels012

Well-known Member
Joined
Jan 13, 2005
Messages
5,219
How can I write code to copy data from one sheet to another if the dates in a certain cell are between the begining date (cell F2) and Ending date (cell F3)

Thank you,
Michael
 
If format(c.Value,"MMM") = Format(DateAdd("m", -1, e2), "MMM") Then

This works very well!!!
only, If I use the code for this Month 12/17/2005 it gives me November for the formula to work.
It copies every November month

I need just last November. That is why I want to use the G2 cell and G3 cell in the code to get => and =< to give me last November only.

Michael
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,453
Messages
6,124,927
Members
449,195
Latest member
Stevenciu

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