Learningvbaexcel1
New Member
- Joined
- Dec 26, 2020
- Messages
- 3
- Office Version
- 2016
- Platform
- Windows
I am in charge of the expiration dates of a large grocery distribution warehouse. Our inventory levels for any given item fluctuate with the season, holidays, etc. I may have one pallet in house or I may have hundreds.
I have been working on a macro that reorganizes the information into a manageable format and looks for problems with dates. The data right now is organized into 6 columns of information, all read into an array for faster processing.
My receivers don't always pay attention to the dates when they receive, so instead of putting 1/5/21, they may put 11/5/21 or other weird dates. There are other rules I have to follow, but once I get the base coding down, I can add the other rules easily enough.
I can get the information out of the array, but I think I'm missing something at the next part. I might be on the right track, but is there a more efficient way to do this?
Basically,
For i from 1 to Lastrow
set variable to first item number
While j is (equals) item number
Copy array row to work area
When j no longer equals item number
Process rules for this particular area
If errors found, post info to report
If no errors found, continue
Clear the work area
Get the next item number and repeat above
The database is already sorted by item number and then by expiration date. Since I don't know how many pallets I have of each item, I want it to be fluid.
Am I setting the variable in the right place? Is this the most efficient way to accomplish this task?
The other option I was considering is copying the item number to another area, and then comparing it, but that seems like a lot of extra code for the same task.
Thank you
I have been working on a macro that reorganizes the information into a manageable format and looks for problems with dates. The data right now is organized into 6 columns of information, all read into an array for faster processing.
My receivers don't always pay attention to the dates when they receive, so instead of putting 1/5/21, they may put 11/5/21 or other weird dates. There are other rules I have to follow, but once I get the base coding down, I can add the other rules easily enough.
I can get the information out of the array, but I think I'm missing something at the next part. I might be on the right track, but is there a more efficient way to do this?
Basically,
For i from 1 to Lastrow
set variable to first item number
While j is (equals) item number
Copy array row to work area
When j no longer equals item number
Process rules for this particular area
If errors found, post info to report
If no errors found, continue
Clear the work area
Get the next item number and repeat above
The database is already sorted by item number and then by expiration date. Since I don't know how many pallets I have of each item, I want it to be fluid.
Am I setting the variable in the right place? Is this the most efficient way to accomplish this task?
The other option I was considering is copying the item number to another area, and then comparing it, but that seems like a lot of extra code for the same task.
Thank you