Results 1 to 3 of 3

VBA Help Needed: Created an Object but getting an error : user defined type not defined

Threaded View

  1. #1
    Registered User
    Join Date
    06-26-2016
    Location
    NYC
    MS-Off Ver
    2011
    Posts
    2

    VBA Help Needed: Created an Object but getting an error : user defined type not defined

    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
    Last edited by Leith Ross; 06-26-2016 at 12:51 AM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Compile error user defined type not defined
    By elloco240866_Alsdorf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2015, 02:26 AM
  2. Compile error: User- defined type not defined
    By rolex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2015, 05:08 PM
  3. Compile error: user defined type not defined
    By duhigs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-23-2014, 07:51 PM
  4. [SOLVED] Compile error: User-defined type not defined
    By XmisterIS in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2014, 09:46 AM
  5. compile error - user defined type not defined
    By TMP123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2010, 01:42 PM
  6. VB Compile Error - User-defined type not defined
    By dbwiz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2010, 04:31 PM
  7. [SOLVED] Dictionary object: Error assigning user defined data type to item
    By Paul Urbanus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2005, 12:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1