+ Reply to Thread
Results 1 to 11 of 11

Compile error: Object required

Hybrid View

  1. #1
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    You have the first problems (use of set) because usually set is used with object, range, worksheet, workbook, etc.

    Problem
    Call addFlexibleAxisItem(csvTab, faAxis, faItem, faAction)
    I think you have this problem because the Sub:
    Sub addFlexibleAxisItem(csvTab As String, Axis As String, Item As String, Action As String)
    wants four string variables

    while you declared:
    Dim faItem, faAxis, faAction As String
    that it's not the same then write:
    Dim faItem As String
    Dim faAxis As String
    Dim faAction As String
    In your declaration VB assumes 'faItem' and 'faAxis' as variant (because you don't specify the cariable type) and only 'faAction' as String.

    Regards,
    Antonio

  2. #2
    Registered User
    Join Date
    04-18-2007
    Posts
    2
    Yes, that seems to be the problem. I removed all 'Set' and was more explicit about the types. It's very confusing that

    Dim A, B As Integer
    does not declare two integers... since it is not, it should not even be allowed input.

    But hey, it's just Microsoft, so who cares?

    Thanks,

    Hinnerk

  3. #3
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    If you write:
    Dim A, B As Integer
    Excel assumes 'A' as Variant and 'B' as Integer.

    You can also write so in one row:
    Dim A as Integer, B As Integer
    Regards,
    Antonio

  4. #4
    Registered User
    Join Date
    05-10-2012
    Location
    houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Compile error: Object required

    Hello,
    i saw you post and i am having a simular problem but iam not sure if it is the same fix can you help me out please.
    i am using the set for iLastRow(IE: getting the last row count in order to auto fill based off that value)


    My code keeps crashing on the Set iLastRow....etc...

    Sub MCR_Data_shtData_Format()
    ' MCR_Data_shtData_Format Macro
    ' Formats the Data sheet
    Dim iLastRow As Long
    
    'turns off/on screen actions
    Application.ScreenUpdating = Fasle
    
     With shtComp
    Set iLastRow = shtComp.Cells(Rows.Count, "D").End(xlUp).Row
    End With
    Please help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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