+ Reply to Thread
Results 1 to 8 of 8

Compiler Error: Object Required

  1. #1
    Registered User
    Join Date
    04-22-2012
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Office 365
    Posts
    61

    Compiler Error: Object Required

    I'm getting that error at the Set SkillCatName = CatName line, I cannot see why. As help would be appreciated

    Please Login or Register  to view this content.
    Last edited by RGrunden; 05-19-2012 at 09:43 PM.
    Reality is stranger than fiction.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,357

    Re: Compiler Error: Object Required

    You don't use Set for strings/text. You use Set for objects like Workbooks, Worksheets, etc.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Compiler Error: Object Required

    Are you calling that from the worksheet?

    If you don't pass all of the arguments a function requires to return a result, Excel will not see a dependency, and will not automatically recalculate when the precedents change.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    04-22-2012
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Office 365
    Posts
    61

    Re: Compiler Error: Object Required

    Yes the function is being called from a Worksheet and is inside a Module attached to the Workbook. Once I made the changes TMS suggested the error went away (changing Set to Let for the String and Integer variables). I know the formula as written in the Worksheet was passing all the required arguments. For completeness sake here is the formula as written into cell C3 of the Worksheet:

    =IF(ISERROR(SkillCatCost($A3)),"",SkillCatCost($A3))

    I left row as a relative reference because I wanted to be able to copy and paste that formula into other cells within the same column and have it reference the A column of the row it was in.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Compiler Error: Object Required

    I know the formula as written in the Worksheet was passing all the required arguments.
    I don't think so.

    Your code looks at data on other worksheets.
    Last edited by shg; 05-21-2012 at 10:25 AM.

  6. #6
    Registered User
    Join Date
    04-22-2012
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Office 365
    Posts
    61

    Re: Compiler Error: Object Required

    1) The code may look elsewhere but the function only requires one argument which is being pulled form another cell on the same worksheet.
    2) All worksheets referenced in the code are in the same workbook to which the module is attached.
    3) All referenced ranges have valid data fields.

    4) The error went away when I changed the statements from Set to Let.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Compiler Error: Object Required

    The error goes away, but if you change a value on wsCatData.Range("CatData_CatList"), the function doesn't automatically recalculate. Does that seem like correct behavior?

    If you're fine with it, I'm fine.

  8. #8
    Registered User
    Join Date
    04-22-2012
    Location
    Syracuse, NY, USA
    MS-Off Ver
    Office 365
    Posts
    61

    Re: Compiler Error: Object Required

    The range referenced is on a Data page that will not be modified. So I'm ok with the function not recalculating if a value there changes, because they aren't meant to change.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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