If anyone can generate a VBA code for this, I will be very impressed. This is a tough one for sure, but perhaps a good challenge for someone.
Please see attached screenshot. itemcode3_zps0b041438.jpg
The first 5 columns are user generated, and then once all the fields are entered the VBA will spit out a code in Column F.
The code in column F is a collaboration of the information in Column A, B, C, D and E.
The first part of the code is a 5 digit number that comes from the Supplier and Product. This a random code.
IE, Joe Farms Apple could be 34512. If Farmer Ted has an Apple it would be a different random code like 93249
The second part of the code is the color. It is 2 digits. It is relevant to the suppler and product. Example, a Red Apple from Joe Farms would be 01. A Green Apple from Joe Farms would be 02 and so on. A Green Apple from Farmer Ted, if green is entered first, would be 01 as it is a different Supplier. The color can be re-used for the supplier and product if the size is different.
The third part of the code is from the sizes in Column D and E. This is alphanumeric.
IE, Size:6 and Size:12 would make 0612. Size:02 and Size:RB would be 02RB
Each code can only be generated once. If the information in columns A, B, C, D and E are changed after a the VBA generates a code, do not re-calculate the code. Rather retain the original generated code and highlight the text in Red to show that the columns what generated the code were changed.
The rows can be entered at any time. This means that Row 8 may be entered after Row 9 and 10. Row 9 and 10 would generate a code from VBA, but then a user would enter Joe Farms Banana Blue 12x12 into Row 8. This should still generate a code 68328-03-1212. With other VBA approaches I've seen, this would not work because it came before the calculated code in Row 9 and 10. I hope the VBA can allow to search up and down the spreadsheet for duplicates and such.
Very excited to see if someone can pull this one off!
Bookmarks