I'm trying to find a way to identify how much inventory (INTOnHand), for each item (INTItem), was on hand when a PO was received in the system.
Each row is an inventory transaction and I have everything sorted by item (INTItem) and Date(INTDate). The code does not need to sort, just find the correct data. This is just a sample of the data. The real data has varying numbers of rows, but the columns are always the same.
I'm looking for VBA code to loop through the data. For each INTItem, look at INTType. If INTType = PO, return the the value in INTOnHand of the previous row where INTType does not = PO. Put the value in column P. If there is not a previous INTType <> PO for that item, column P can remain blank.
Example:
Row 10, the INTType =PO, I would like the value in INTOnHand from row 9 (the most previous transaction whose INTType <> PO), so cell P10 would now =301
Row 12, the INTType =PO, I would like the value in INTOnHand from row 9 (the most previous transaction whose INTType <> PO), so cell P12 would now =301
I'm fairly new to VBA, so any help you give will be greatly appreciated. Thank you.
Each row is an inventory transaction and I have everything sorted by item (INTItem) and Date(INTDate). The code does not need to sort, just find the correct data. This is just a sample of the data. The real data has varying numbers of rows, but the columns are always the same.
I'm looking for VBA code to loop through the data. For each INTItem, look at INTType. If INTType = PO, return the the value in INTOnHand of the previous row where INTType does not = PO. Put the value in column P. If there is not a previous INTType <> PO for that item, column P can remain blank.
Example:
Row 10, the INTType =PO, I would like the value in INTOnHand from row 9 (the most previous transaction whose INTType <> PO), so cell P10 would now =301
Row 12, the INTType =PO, I would like the value in INTOnHand from row 9 (the most previous transaction whose INTType <> PO), so cell P12 would now =301
I'm fairly new to VBA, so any help you give will be greatly appreciated. Thank you.