title: Comparing two tables in Excel and hiding rows
body: <p>The goal of my code is to compare two columns in tables within two different sheets. If the values of each cell in each column are the same, then the row in one column is hidden. I keep getting the Type Mismatch error for this line: <code>If myCob2 = myCodes Then</code></p>
  
  <p>Also, is it possible to compare a column in a table in one sheet and just a regular column (not in a table) in another sheet? Thank you!</p>
  
  <pre><code>Option Explicit
  Public Sub AstInv()
  Dim myLibros As ListObject
  Dim myInventory As ListObject
  Dim myCob2 As Range
  Dim myCodes As Range
  Dim cell As Range
  
  Set myLibros = ThisWorkbook.Worksheets("Libros").ListObjects("Table_1")
  Set myInventory = ThisWorkbook.Worksheets("Inventory").ListObjects("Table2")
  Set myCob2 = myLibros.ListColumns("COB2").Range
  Set myCodes = myInventory.ListColumns("Codes").Range
  
  If myCob2 = myCodes Then
  
      For Each cell In myCob2
  
      cell.EntireRow.Hidden = True
      Next
  End If
  
  End Sub
  </code></pre>