title: Compare to workbooks different folder and different cell
body: <p>I'm new on excel vba coding.
  What I try to do is compare two different csv workbooks that are in two different folder and also compare the columns in the sheets (that have diffent position)
  I need also compare more than one couple of csv file. </p>
  
  <p>To explain:</p>
  
  <ol>
  <li>FolderA contain 123 csv file each csv file have a sheet with two column (A and B)</li>
  <li>FolderB contain 123 csv file each csv file have a sheet with three column (A,B,C)</li>
  </ol>
  
  <p>So what i search to do is compare cvs file contain in FolderA to cvs file contain in FolderB. 
  But also check if column A and B contained in csv file in FolderA are equal or different to column A and C contained in csv file in FolderB
  And then create a report to show the difference between the columns compared.</p>
  
  <p>So for example</p>
  
  <pre><code>FolderA                   FolderB
  WoorbookA                 WoorbookA
  ColumnA   ColunmB         ColumnA   ColunmB     ColunmC
  fff       123             fff       ita         123    
  ddd       897             ddd       eng         897 
  ccc       345             ccc       fr          345 
  </code></pre>
  
  <p>report new workbook with 2 columns to mark the difference</p>
  
  <p>Code I try to use below.
  It lacks some instruction I know but i haven't find out nothing refer to</p>
  
  <pre><code>        Sub CompareWorkBooksNew()
  
      Const File_LocationA = "D:\SteamLibrary\steamapps\common\Crusader Kings II\localisation\"
      Const File_LocationB = "D:\_GAMES\_TRADUZIONI\Traduzione CKII\Trad. Ita 3.3.2 OXYG\Trad. Ita Ck2 3.3.2\localisation\"
  
      Dim wbkA As Workbook, wbkB As Workbook
      Dim SheetA As Worksheet, SheetB As Worksheet
      Dim File_NameA As String, File_NameB As String
      Dim count As Integer, i As Long
      Dim arA As Variant, arB As Variant
  
      File_NameA = Dir(File_LocationA &amp; "*.csv")
  
       ' report workbook
      Dim wbReport As Workbook, iRow As Long
      Set wbReport = Workbooks.Add()
      wbReport.Sheets(1).Range("A1:F1") = Array("File", "Row", "A", "B", "A new", "C new")
      iRow = 2
  
      Do While File_NameA &lt;&gt; ""
           File_NameB = "traduzione_" &amp; File_NameA
          'Debug.Print File_NameA, File_NameB
  
          'Get the worksheets from the workbooks
          Set wbkA = Workbooks.Open(File_LocationA &amp; File_NameA, , True)
          Set SheetA = wbkA.Worksheets(1)
          arA = wbkA.Sheets(1).UsedRange.Columns("A:B").Value2
          wbkA.Close False
  
          Set wbkB = Workbooks.Open(File_LocationB &amp; File_NameB, , True)
          Set SheetB = wbkB.Worksheets(1)
          SheetB.Columns(2).Delete
          arB = wbkB.Sheets(1).UsedRange.Columns("A:B").Value2
          wbkB.Close False
          'Debug.Print UBound(arA), UBound(arA, 2), UBound(arB), UBound(arB, 2)
  
          ' check equal size
          If UBound(arA) &lt;&gt; UBound(arB) Then
              MsgBox "Rows in A = " &amp; UBound(arA) &amp; vbCr &amp; _
                     "Rows in B = " &amp; UBound(arB), vbCritical, "Error"
              Exit Sub
          End If
  
          ' compare arrays
          For i = LBound(arA) To UBound(arA)
              If arA(i, 1) &lt;&gt; arB(i, 1) Or arA(i, 2) &lt;&gt; arB(i, 2) Then
  
                  ' report here
                  With wbReport.Sheets(1)
                      .Cells(iRow, 1) = File_NameA
                      .Cells(iRow, 2) = i
                      .Cells(iRow, 3) = arA(i, 1)
                      .Cells(iRow, 4) = arA(i, 2)
                      .Cells(iRow, 5) = arB(i, 1)
                      .Cells(iRow, 6) = arB(i, 2)
                  End With
                  iRow = iRow + 1
  
                  'Debug.Print arA(i, 1), arA(i, 2), arB(i, 1), arB(i, 2)
  
              End If
          Next
  
          File_NameA = Dir() ' get next file
          count = count + 1
      Loop
      wbReport.SaveAs ("D:\_GAMES\_TRADUZIONI\Traduzione CKII\Controllo Versioni2.xlsx")
      wbReport.Close False
      MsgBox count &amp; " files compared in " &amp; File_LocationA, vbInformation
  
  End Sub
  </code></pre>
  
  <p>Thanks to all that could help me</p>