title: QTP/UFT: Comparing two excelsheets easy and performant using VB
body: <p>I want to compare 2 Excel-Sheets in VB.
  I know how to open these sheets in QTP/UFT
  I know how to get the ranges of all cells.
  But I do not know a performant way to compare these 2 sheets (ranges).</p>
  
  <p>If a Value in 2nd Sheet is different to the corresponding value in first sheet it shall be inserted in the corresponding cell of 2nd Sheet.
  I can parse all cells in serial to compare with the corresponding cell, but this is not very performant.</p>
  
  <p>I want to compare it in following way:</p>
  
  <pre><code>If not (sheet1.range() equals sheet2.range()) then
    if not (Sheet1.range.Row equals sheet2.range.row) then
      if not (Sheet1.range.Row.cells equals Sheet2.range.Row.cells) then
        Sheet2.range.Row.cells.value = Sheet1.range.Row.cells.value
  </code></pre>
  
  <p>All Values could be in different rows and cells but there are corresponding ID in first Column and in the Header of columns.
  So I have to parse for the correct row-ID in both sheets and the corresponding Column in both column headers.
  I do not want to use a formula in the sheet, because I have to do the comparison in programmatical way.</p>
  
  <p>Could someone please give me a hint if there is a function, method or property in Excel I could use?
  Thanks in advance</p>