Hello everyone!
I am trying to evaluate a set of records to determine if they should be posted to a display. Then evaluate a second set of records to either, post next to the prior month with the same item (project), fill in a blank space for that area (department), or add a new line to that area (department).
I can do the basics and have it looping through and it works! The problem is that it takes about 38-40 to run everything and it seems like ~30 seconds to run these loops (for an example of 47 months, 36 records to be read, and a starting display table of about 25 rows and after the macro with about 33 rows). I am posting the basic idea immediately below.
Read from table:
1.) Read each record.
2.) If that record has a 'True' indicating it should be posted for that month (from a formula reading a date that changes for each month) we enter another loop for placing it.
3.) We read each record on the table for placement. We check to see if the department matches. When the department matches, we check to see if the same project was listed in the prior month. If it was, we enter the information next to the same project.
4.) If the project does not match the prior month, then we loop through the display table again. When we find the same department, we find the next empty cell to enter the project.
5.) If there are not enough empty cells for that department, then we loop through the display table again. We find the last row in the display table for the same department. Then we add a row and enter the project.
6.) There is an additional loop to represent months that carry forward into future years.
Then we go back and read the next record to be evaluated. The current year (8 months) seems to take all the time and that is where most of the records will be displayed. It seems to pass through the loops very fast for the future years with very little being posted (hence not looping on the display).
Is there ANY way to complete the same actions and greatly reduce the time to post each project in the correct spot on the display? I have attached a copy of the loop hoping that would be enough information to evaluate. The I have about 9 subroutines being called but everything else is at most a second (maybe two). I am hoping to be able to run the macro when the workbook opens.
Thank you!
Bookmarks