Hi There,
I am trying to create an iterative macro that will compare the leaves taken by a person adjust the leave balance accordingly.
So we have a data with the details of leave taken by a person with start and end date of the leave and the hours utilized in the leave. These are identified by the employee ID provided in the field [NR] (see example below)
Leave Hours
And we have another data that lists all the leave hours that a person can use based on different category each having different expiration date (see the example below)
Leave balance
So I would like to create an iterative macro that would calculate the balance of leave hours each person has according to the leaves they have taken. If the leave hours they have taken exceeds the first category within the expiration date, then it should utilize the hours from next category and then adjust the balance accordingly.
I have created a macro, but it takes almost half an hour each time if I run with data of multiple persons. So I would like to know if there is an easier way to create the macro that would help me to achieve the same results with less time. Attached the macro for reference.
Thanks in advance,
Hanz