Hi !
This is my first time creating an object and I am getting "user-defined type not defined" error. I have a spread sheet with a list of ingredients and properties associated with each ingredient. I created a grocery object to feed the ingredient data and all the properties and create a collection of objects. Your help will be greatly appreciated, thanks in advance. The code is below:
Sub WorkingSheet()
Dim WSws As Worksheet: Set WSws = ThisWorkbook.Worksheets("Working Sheet")
Dim Calws As Worksheet: Set Calws = ThisWorkbook.Worksheets("Calculations")
Dim ShipID As Integer
Dim GroceryObj As Grocery
Dim GroceryCol As New Collection
Dim i As Integer
With WSws
i = 3
Do Until i > Calws.Cells(6, 3).Value
Set GroceryObj = New Grocery
GroceryObj.ShipID = .Cells(i, 2)
GroceryObj.Cycle = .Cells(i, 3)
GroceryObj.Batching = .Cells(i, 4)
GroceryObj.Ingredient = .Cells(i, 6)
GroceryObj.KK = .Cells(i, 7)
GroceryObj.PrepStart = .Cells(i, 11)
GroceryObj.PrepEnd = .Cells(i, 12)
GroceryObj.TablePPM = .Cells(i, 13)
GroceryObj.AutoPPM = .Cells(i, 14)
GroceryObj.PrepMethod = .Cells(i, 16)
GroceryObj.AutoPPM = .Cells(i, 14)
GroceryObj.ShiftLength = .Cells(i, 21)
GroceryObj.PrepByFlag = .Cells(i, 22)
GroceryObj.PrepNeed = .Cells(i, 17)
GroceryObj.PrepTime = .Cells(i, 20)
GroceryCol.Add GroceryObj
End With
i = i + 1
Loop
End With
End Sub
Bookmarks