title: Trying to add all borders to range with variable row count in excel vba
body: <p>I am trying to add all borders to the contents below the headers that I have. The range would be A7 to Ox where x is the last row of content.  The first part of the code listed looks for CFS-GHOST-DJKT and deletes the row which works perfectly.  I am unsure about how to select the lower ending row correctly.</p>
  
  <pre><code>Dim x As Long
  For x = Cells(Rows.Count, "A").End(xlUp).Row To 7 Step -1
      If Cells(x, "A") = "CFS-GHOST-DJKT" Then Rows(x).Delete
  
  
  'Add Gridlines=========================================================
  
  
        Range(A7, Ox).Select
        With Selection.Borders
              .LineStyle = xlContinuous
              .ColorIndex = 0
              .TintAndShade = 0
              .Weight = xlThin
  
        End With
  </code></pre>