Macros Compare the last two months and remove the coloring in the first

K0st4din

Well-known Member
Joined
Feb 8, 2012
Messages
501
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Hello, everyone,
thanks to your help, so far I have been dealing with a lot of troublesome tasks for me.
I'm here again for your help.
I have a large database table.
With other macros, I get almost to the end of this table.
I have a dilemma with which I can not fight.
The table has a range of A2:AB - by the end.
In column "D" are the dates (day, month, year), in column "G" - are the numbers or names, in column "J" - there are codes.
I'm looking for a macro that can check for the last two months (regardless of who they are) to repeat the codes in "J", according to the numbers or names in "G" against the dates in column "D".
For example, if I compare the December 2018 and January 2019 and the same number in column "G" have the same codes in column "J", make (remove) the coloration and colorless the cell (in the example given in December 2018 ) - (we are talking about all comparisons in the table).
If this condition is repeated several months back, then leave colored "G" cells without changing anything in them.
Attach a pic, if you want an example table, I will attach.
I ask for your help because I review thousands of rows and spoil my eyes from watching in every single line.
If you have questions, please ask them to explain even more.
I thank everyone for your cooperation.
picture - https://drive.google.com/file/d/1UrNInwHJ9TaIeZJ_aJHHkQt7D4VJVs7a/view

https://drive.google.com/open?id=1UrNInwHJ9TaIeZJ_aJHHkQt7D4VJVs7a
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I tried to explain it a little more understandably
The structure is as follows:
there are three important columns:
Column "D" - months,
column "G" - the number
column "J" - codes
Looking macro that if a code column "J", under the same number of column "G", it has more than two months ago to stay colored numbers, but if, for example, in January 2019 ( "D") have number in the column "G" - 12345 and in February 2019 we have the same number in the column "G" - 12345, the number in January column "G" - to be made - No fill.
If, however, this column code "J", is repeated for more than two months (February, January, December, November, etc. column "D") and the number in column "G" is the same, not to change the pink color.
And so the check is going on, with information being superimposed next month
 
Upvote 0
Hello,
once there are no answers, there is obviously something that is not clear.
I really pray for some help.
If you have questions, please ask me.
I keep trying, but somehow I fail to count a specific number and the code for something, how many months I repeat. Somewhere I miss something, personally to me.
Thanks again to everyone.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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