Forum Discussion

awhawh's avatar
awhawh
Contributor
8 years ago

Excel comparison cell by cell using Text method returning hash characters

Hi,

 

I'm trying to compare two excel files cell by cell and then calling aqString.Compare to do the actual comparison on the text returned. I've got the mechanism working; however, the 'Text' method appears to return what is visible in the cell, but not always the actual value i.e. if a date is too long for the column width, hash characters are displayed and are returned by the Text method. This means that, for example, both excel files return ######## and that aqString.Compare(str1, str2, false)) will return 0 (i.e. the strings are the same). I deliberately changed the dates so they were different.

 

The 'value' method returns nothing

 

Does anyone know away to return the actual cell value or to apply AutoFit when working with files that are not open and visible on the desktop

 

Thanks


Adam

  • Hi,

     

    Are you using which method to get the cell value using Range("A1") or Cell(1,1)? 

     

    both has property called Value2 or Value_2 to get cell value can you try these.

     

    If still face any issues, post your code here.

  • shankar_r's avatar
    shankar_r
    Community Hero

    Hi,

     

    Are you using which method to get the cell value using Range("A1") or Cell(1,1)? 

     

    both has property called Value2 or Value_2 to get cell value can you try these.

     

    If still face any issues, post your code here.

    • awhawh's avatar
      awhawh
      Contributor

      Thanks, Shankar.

       

      Value2 doesn't actually display the date in a date format, unfortunately, but it does at least recognise the difference in the dates which is the main thing