IsError? - Page 2
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: IsError?

  1. #11
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    No it will not
    MyType = TypeName(Cells(6, 1).Value)
    Notice typename.
    Cells are variants by default.
    A variant can contain most any datatype.
    If Cells(6, 1).Value contained a string "Error" then in the above code:
    MyType would = "String" not "Error".
    TypeName is a VB function which returns the data type of the variant.
    In this case an Error

    Tom

    [ This Message was edited by: TsTom on 2002-04-02 08:09 ]

  2. #12
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Great! Thanks for the explanation Tom. I'm not the type of person who takes a solution and runs, I like to understand what I'm using. Thanks again!


  3. #13
    Board Regular
    Join Date
    Feb 2002
    Posts
    97
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Tom, or anyone, after running that code from Tom I'm getting an Invalid Qualifier error. It points to the
    myType = TypeName(Cells(8, 1).Value)
    line (highlighting typename). Is this a problem with my variant myType, it is declared as a String. ???

  4. #14
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Hey

    The function TypeName returns a string.
    I'm using Office 2000.
    I do not know if this function came with earlier version of VB/VBA?

    I tested the code as such:

    Placed this formula in A1 to generated the #NULL! error.
    =SUM(B1 C1)

    Ran this code to see what would be assigned.

    Sub SeeError()
    Dim MyType As String
    Dim CheckCell as Boolean

    CheckCell = IsError(Cells(1, 1).Value)
    MyType = TypeName(Cells(1, 1).Value)

    Debug.Print "CheckCell = " & CheckCell
    Debug.Print "MyType = " & MyType

    'CheckCell = True
    'MyType = "Error"
    End Sub

    It works for me!
    Tom


    [ This Message was edited by: TsTom on 2002-04-02 11:07 ]

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com