Results 1 to 9 of 9

Converting variant return type from evaluate to integer

Threaded View

  1. #1
    Registered User
    Join Date
    10-07-2009
    Location
    Westford, MA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Converting variant return type from evaluate to integer

    I would like to get the return value for an evaluate statement which is a variant data type, convert it to an integer and do some computation. I have 4 test programs, the first 3 all work, the 4ths does not.

    The first sd_test(returns 1) and st_test1(returns 1) demonstrate that my evaluate statement is correct and works,

    sd_test2(returns 3) shows that I can convert a variant to an integer

    in sd_test3(returns #VALUE!) I try to put both together and it doesn't work?
    any help? thanks paul



    Function sd_test()
    Dim X As Variant
    X = Evaluate("=row(myTable[#Headers])")
    sd_test = X
    End Function
    
    Function sd_test1() As Variant
    Dim X As Variant
    X = Evaluate("=row(myTable[#Headers])")
    sd_test1 = X
    End Function
    
    
    Function sd_test2() As Integer
    Dim X As Variant
    Dim Y As Integer
    X = 3
    Y = CInt(X)
    sd_test2 = Y
    End Function
    
    
    Function sd_test3() As Integer
    Dim X As Variant
    Dim Y As Integer
    X = Evaluate("=row(myTable[#Headers])")
    Y = CInt(X)
    sd_test3 = Y
    End Function
    Last edited by NBVC; 10-07-2009 at 12:24 PM. Reason: Solved

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