title: Macro that Deletes/Clears contents of table in excel but keep the last three columns
body: <p>I currently have a copy/paste macro that looks up a string text within my workbook destination  that opens a source data workbook and copies and pastes back into the workbook destination. I added two pieces in my code that clear the contents and then will delete any rows that have blank cells in the first column. I use this code on numerous workbooks that is able to successfully clear and resize the table I have a copy/paste macro in.</p>
  <pre><code>    Dim wbSourceData As Workbook
      Dim wbDestination As Workbook
      Dim wsSourceData As Worksheet
      Dim wsDestination As Worksheet
      Dim strFName As String
      Dim rng1 As Range
      Dim rng2 As Range
      Dim tbl As ListObject
      Dim Cl As Long
      Dim Rl As Long
      
  
      Set wbDestination = ThisWorkbook
      Set wsDestination = wbDestination.Sheets(&quot;Data Table&quot;)
      
      strFName = wbDestination.Worksheets(&quot;Macros&quot;).Range(&quot;C2&quot;).Value
      
      Set wbSourceData = Workbooks.Open(strFName)
      Set wsSourceData = wbSourceData.Worksheets(2)
      
      Set tbl = wsDestination.ListObjects(&quot;Data_Table&quot;)
      
      tbl.DataBodyRange.ClearContents     'This clears the contents of the table
      
      With wsSourceData
      Cl = .Cells(2, .Columns.Count).End(xlToLeft).Column
      Rl = .Cells(.Rows.Count, &quot;A&quot;).End(xlUp).Row
      Set rng1 = .Range(.Cells(2, &quot;A&quot;), .Cells(Rl, Cl))
      End With
      
      rng1.Copy
      wsDestination.Range(&quot;A4&quot;).PasteSpecial xlValues
      
      Application.CutCopyMode = False
  
      wbSourceData.Close SaveChanges:=False
      
      On Error Resume Next
      Set rng2 = Range(&quot;Data_Table[[Names]]&quot;).SpecialCells(xlCellTypeBlanks)
      On Error GoTo 0
      If Not rng2 Is Nothing Then
          rng2.Delete Shift:=xlUp                  'This deletes rows with blank cells in the first column
      End If
      
  End Sub
  </code></pre>
  <p>The name of the tab that the source data is being pasted to is &quot;Data Table&quot;.
  The name of the table in this sheet is called &quot;Data_Table&quot;.
  The first column in this table is called &quot;Names&quot;.
  The name of the tab that the string looks up is called &quot;Macros&quot;.</p>
  <p>I realized this code will delete all data inside the table, which does not work when there are formulas inside the table that I need to remain. So pretty much I am looking to add to this code a way where the last three columns in this table do not get deleted as they are formulas (columns R-S or 18-20) but still keep the rest of the code in tact as it works well. I am a beginner in VBA so I would appreciate responses in an ELI5 format. Thank you.</p>
  <p>Please let me know if you need any clarification of names inside my code.</p>