Results 1 to 3 of 3

Thread: Determine data type

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2005
    Posts
    394

    Determine data type

    I'm using typeof to determine the type of an object and keep getting an error that says: Argument 'Number' cannot be converted to a numeric value. The error occurs on bold line below.

    vb Code:
    1. [B]If TypeOf Str((CType(oShtData.Cells(2, 1), Excel.Range).Value)) Is String Then[/B]
    2.             'Copy variable names from the data worksheet.  This data was imported form the CSV
    3.             CType(oShtData.Rows(2), Excel.Range).Copy()
    4.             'Transpose and Paste the data into the Control worksheet
    5.             CType(oShtCont.Cells(2, 8), Excel.Range).PasteSpecial(Excel.XlPasteType.xlPasteValues, , , True)
    6.         End If

    If I debug the this line it looks fine. The difference is that I cannot use ctype in the watch window.
    Attached Images Attached Images  
    Last edited by campster; Apr 17th, 2007 at 02:26 PM.

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