title: How do I Put in a pass through Table name so the Macro isn't bounded to the one worksheet?
body: <p>I'm trying to put together a Worksheet where if I click on a button on top it passes my conditional formatting through, as well as inserting a new line. However I feed through the Table name in the code, so if I try to copy the worksheet or try running the macro on another sheet, it breaks.</p>
  <p>I put the code in ** around the changes i'm thinking of, however I'm stuck how to pass it on the <strong>Set</strong> line.</p>
  <p>Help please!!</p>
  <p>Example:</p>
  <pre><code>Dim ws As Worksheet
  **Dim tbl As ListObject**
  
  Set ws = ActiveSheet
  **Set tbl = ws.ListObjects(1)** &lt;-- This lets me get the table name if this worksheet is copied.
  
  
  Dim rng As Range
    
  Set rng = ws.[TableName[ColumnName]]
  **Set rng = ws.[tbl[ColumnName]]** &lt;- If I do this it Breaks.
  </code></pre>