Forum Discussion

gehrig44's avatar
gehrig44
Occasional Contributor
14 years ago

Exception when using a Keys Operation with Data Table cell value

I get an exception when using a Keys Operation when the value equals a blank Data Table cell. 



This a keyword test set to key the Data Table cell value to a specified form.  However, if the cell is empty, other than entering nothing, there is an exception. 



I really want to avoid the Try/Catch method around each Keys operation that is using the Data Table cell values.  I also want to leave these keyword operations so that the spreadsheet data can be changed on the fly without the need of changing the scripts.

5 Replies

  • gehrig44's avatar
    gehrig44
    Occasional Contributor
    Thinking the best way to go about this is to do an If/Then for each key operation. 



    If Data Table value != "" Then do key operation. 
  • gehrig44's avatar
    gehrig44
    Occasional Contributor
    Sorry about the repost, but I dont see any edit buttons.





    My main issue now is I can't figure out what value is being used on blank Excel cells.  I setup an If/Then like above.  I tried making the Data Table value equal an empty string, Null, and null but those didn't work.  The only thing that works is if I create another Excel spreadsheet with blank cells in it and compare a blank cell in that table to my other Data Table. 





    I printed the value of the empty cell to my log file, and it is indeed bank.  Any ideas what the value of a blank cell would be?





      Thanks
  • gehrig44's avatar
    gehrig44
    Occasional Contributor
    I am able to GetVarType and it does return that the cell is varNull.  But, I am not sure how I implement this into my If/Then statement.  I tried Constant/Variant/varNull and Null and null.  Also, tried as strings.  But those don't work.




  • Hi,



    Try using a code expression as the second value in If's condition. That is:

    Value1 - the needed cell of your DB table variable (Table Data type).

    Condition - not equal to

    Value2 - Code expression 'null' (without quotes).