Link to home
Start Free TrialLog in
Avatar of pauledwardian
pauledwardian

asked on

vba macro

I need a macrocode that would look at column S2 and sees if the dates that are in that column are out of date as of today and if that's the case, then the code copied the rows that are outdated depending on column S2 and copy those in sheet6. The data needs to be copied after a specific row on sheet6 that is called "sample". For example if rows b3,f7 are outdated depending on column s2, then the code needs to select those entire B3 and f7 individually and copies those two rows to sheet6 after the row that is called "sample".
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

couple of questions
1) look in Col S2 what sheet ?
2) out of date as of today = not today ? or > today or < today or > and < today ???
3) copy in the row that is called sample = dample i in col a or where ?

gowflow
could you post a sample workbook as you refering to row when you indicate acell refrence
like column S2 but S is a column and S2 is a cell !!!

alsoFor example if rows b3,f7 are outdated but b3 is a cell not a row nad f7 also is a cell not a row.

So to make it easier pls try and post a sample workbook removing personal data.
gowflow
Avatar of pauledwardian
pauledwardian

ASKER

Thank you for your time gowflow. Please see the screenshot. Hopefully this would make ir more clear.  User generated image
Please let me know if you would like more details.
ok noted your pic but do not understand what do you mean by OUTDATED !!! not clear at all
why 2-9 and 18-24 are outdated ? what is the criteria ?

Also I understand row 10-17 need to be copied to Sheet6 after encountering the word Sample but question is what in Row 10-17 need to be copied and starting col a ???

In your sample if you had filled some non relevant data it would have been obvious as a picture is worth 1000 words !!!

will wait for your clarifications to build it accordingly.
gowflow
I think I see what you mean by outdated you mean out of sequence !!!!
row 2 to 8 the date follows and is by one day interval row 9 the date changes so this is where you wan tto start recording the sequence till row 18 where again the sequece changes till row 24 so for me I see following 3 sequence
2 to 8     dates from 1/1/2011 to 1/7/2011
9 to 17   dates from 12/1/2011 to 12/9/2011
18 to 24 dates from 2/10/2011 to 2/16/2011

So the question is why you decided that it is 2-9 and 18-24 that need to be pasted ? I don't understand the logic for selection if any it should be 2-8 not 2-9 !!! and why 9-17 is leftout ????

gowflow
You are correct. I accidentally had 2-9 which actually should be 2-8.
I provided this as sample. The dates are not on sequence. So, basically any row that is outdated as of today's date needs to be copied to the destination sheet under sample  which is sheet6.
Hope this made it more clear.

Paul
yes but the whole row should be copied like from col A to whatever pated to Col A under Sample ???
gowflow
Yes the entire row needs to be copied if it meets that condition.

Paul
Paul
Again its not clear
You say:
The dates are not on sequence. So, basically any row that is outdated as of today's date needs to be copied to the destination
>>>
All the dates have nothing to do with today so in this case you would copy all of them in your example ?
You mention the 2 groups 2-9 and 18-24 and then you say any date outdated with today ?? I am confused pls explain in plain english what you need to be copied once you do it its a matter of minutes and you will get the solution

gowflow
gowflow

 I apologize for the misunderstanding. I meant the Past Due (Due dates past current date). Please look at the screenshot. All the rows marked in yellow needs to be copied since their dates are past current.

Paul User generated image
AAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa NOW ITS CLEAR !!!!! Past Current date Thank you and finally !!!

Pls check this file to run it make sure your macros settings are set to medium and enable macros when you run the file. Press in sheet on the button Copy Past Due Dates and check the results in sheet6.

If you like and not familiar with vba I can help you to incorporate it in your production file.
Rgds/Gowflow
CopyPastDueDates.xls
Thank you very much gowflow. This is exactly what I was looking for.
Just one more comment. Would you please have the code to insert a row after the last row of data that was copied into sheet6. So, in your sample the code needs to insert a row and call it "sample2" after the last row of data copied into sheet6(which would be row 57 in this case)

Thanks again,
Paul User generated image
Also, would you please take a look at this sample workbook. The code did not work on this workbook. Maybe it is because of the spaces that are in sheet1. This is totally my fault because I had to upload my primarily worksheet instead of a sample worksheet. :)

Thank you,
Paul Main-Sample.xls Main-Sample.xls
ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
YOU ARE THE MAN gowflow.
Would you also please help me out in my other two questions?
1) https://www.experts-exchange.com/questions/27432306/macro.html

2) https://www.experts-exchange.com/questions/27432225/vba.html

Again I really appreciate you helping me on this.

Regards,
Paul
Thanks again and please see if you would be able to help me and on these two requests :)

https://www.experts-exchange.com/questions/27432306/macro.html

https://www.experts-exchange.com/questions/27432225/vba.html