Results 1 to 6 of 6

Thread: wrong data type?

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Location
    Holland
    Posts
    34

    wrong data type?

    Does anyone know why following function gives me run-time error 424, object needed?
    VB Code:
    1. Function LookOneBack() As Variant
    2.  
    3. Application.Volatile
    4. LookOneBack = Application.Caller.Offset(0, -1).Value
    5.  
    6. End Function

  2. #2
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: wrong data type

    Quote Originally Posted by Tobian
    Does anyone know why understanding function gives me run-time error 424, object needed?
    VB Code:
    1. Function LookOneBack() As Variant
    2.  
    3. Application.Volatile
    4. LookOneBack = Application.Caller.Offset(0, -1).Value
    5.  
    6. End Function
    what is this along (sub)?
    Application.Volatile
    oh1mie/Vic


  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2006
    Location
    Holland
    Posts
    34

    Re: wrong data type?

    I am working VB in Excel. It's a VBA function.

  4. #4
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: wrong data type?

    Quote Originally Posted by Tobian
    I am working VB in Excel. It's a VBA function.
    No parameters?
    Try
    VB Code:
    1. Call Application.Volatile
    oh1mie/Vic


  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2006
    Location
    Holland
    Posts
    34

    Re: wrong data type?

    The bug is in the next row.

  6. #6
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043

    Re: wrong data type?

    Application.Caller don't have any Offset methods

    VB Code:
    1. Select Case TypeName(Application.Caller)
    2.     Case "Range"
    3.         v = Application.Caller.Address
    4.     Case "String"
    5.         v = Application.Caller
    6.     Case "Error"
    7.         v = "Error"
    8.     Case Else
    9.         v = "unknown"
    10. End Select
    11. MsgBox "caller = " & v
    oh1mie/Vic


Posting Permissions

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



Click Here to Expand Forum to Full Width