title: VBA: How to refer to columns using table headings so I can use that column in a cell reference
body: <p>So basically I have a code that aims to find and delete rows if they have two columns that meet certain conditions. However, the position of these columns in the table are often variable so I need to reference the two columns using their table header name. I had an approach to using the column numbers to find and delete these rows but adapting it to the column names didn't work the same way. How can I tweak my code to make it work? Could I possibly even use the FIND function instead?
  Thanks in advance!</p>
  
  <p>Code:</p>
  
  <pre><code> 1 Sub try()
   2    
   3 ThisWorkbook.Sheets("report").Activate
   4 Last1 = Cells(Rows.Count, "A").End(xlUp).Row     
   5 For p = Last1 To 1 Step -1
   6   If (Cells(p, "Table1[type]").Text) = "active" And (Cells(p, "Table1[data]")) &lt;&gt; "" Then
   7       Cells(p, "A").EntireRow.Delete
   8   End If
   9 Next p
  10 End Sub    
  </code></pre>