title: QTP/UFT - Access multiple datasheets in loop
body: <p>I am comparatively new to QTP/UFT. I am writing a test and need to use data from Global as well as Local Data Sheet in same test.</p>
  
  <p>My <code>for</code> loop is something like:</p>
  
  <pre><code>Datatable.GetSheet("Global")
  RowCount = Datatable.GetRowCount
  For Cntr = 1 to RowCount
      Datatable.SetCurrentRow(Cntr)
      msgbox Datatable("Form", dtGlobalSheet) 'Form is my column Name from Global Data Sheet'
  
      Datatable.GetSheet("Action1")
      RowCount2 = Datatable.GetRowCount
      For Cntr2 = 1 to RowCount2
          Datatable.SetCurrentRow(Cntr2)
          msgbox Datatable("Number", dtGlobalSheet) 'Number is my column Name from Action1 Data Sheet'
      Next
  Next
  </code></pre>
  
  <p>My column values are getting messed up from both sheets.</p>