title: Compare table columns with current date in excel VBA
body: <p>I'm trying to write an excel VBA to compare columns of a table with the current date and highlight if true.</p>
  
  <p>Here is an example table:</p>
  
  <p><a href="https://i.stack.imgur.com/rmv7n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rmv7n.png" alt="enter image description here"></a></p>
  
  <p>The code that I'm working on is:</p>
  
  <pre><code>Private Sub Workbook_Open()
      Dim tbl As Excel.ListObject 'Table name
      Dim lr As Excel.ListRow 'Row index
      Dim ws As Excel.Worksheet 'Work sheet
      'column names
      Dim keepInTouch As Range, invite As Range, present As Range, follow As Range
  
      Set ws = ThisWorkbook.Worksheets(1)                                 'select work book index 1
      Set tbl = ws.ListObjects("ContactList")                             'set ContactList to tbl
      Set keepInTouch = tbl.ListColumns("Keep in Touch").DataBodyRange    'Select the appropreate header
      Set invite = tbl.ListColumns("Invite").DataBodyRange
      Set present = tbl.ListColumns("Present").DataBodyRange
      Set follow = tbl.ListColumns("Follow").DataBodyRange
      'MsgBox tbl
      For Each lr In tbl.ListRows
          If lr.Range(1, tbl.ListColumns("Keep in Touch").Index).Value &lt;&gt; Date Then
              keepInTouch.Interior.ColorIndex = xlNone
              keepInTouch.Font.ColorIndex = 1
              keepInTouch.Font.Bold = False
          'If keepInTouch(1).Value = Date And keepInTouch(1).Value &lt;&gt; "" Then
          ElseIf lr.Range(1, tbl.ListColumns("Keep in Touch").Index).Value = Date Then
              keepInTouch.Interior.ColorIndex = 3
              keepInTouch.Font.ColorIndex = 2
              keepInTouch.Font.Bold = True
          End If
          Next lr
  End Sub
  </code></pre>
  
  <p>Line 19: <code>If keepInTouch.Index = Date And keepInTouch.Index &lt;&gt; "" Then</code> causes </p>
  
  <pre><code>Run time error '438':
  Object doesn't support this property or method.
  </code></pre>
  
  <p>What is the correct way of doing this?</p>