title: Border around each cell in a range
body: <p>I am trying to create a simple function that will add borders around every cell in a certain range. Using the wonderful recording this generates a ton of code which is quite useless. The code below will display a 'table' of data, around each cell in this range I would like to add a border. Online I haven't been able to find a simple or clear answer for this.</p>
  <p>All help is much appreciated!</p>
  <pre><code>Set DT = Sheets(&quot;DATA&quot;)
  endRow = DT.Range(&quot;F&quot; &amp; Rows.Count).End(xlUp).Row
  result = 3
  
  For I = 2 To endRow
      If DT.Cells(I, 6).Value = Range(&quot;B1&quot;).Value Then
          Range(&quot;A&quot; &amp; result) = DT.Cells(I, 6).Value
          Range(&quot;B&quot; &amp; result) = DT.Cells(I, 1).Value
          Range(&quot;C&quot; &amp; result) = DT.Cells(I, 24).Value
          Range(&quot;D&quot; &amp; result) = DT.Cells(I, 37).Value
          Range(&quot;E&quot; &amp; result) = DT.Cells(I, 3).Value
          Range(&quot;F&quot; &amp; result) = DT.Cells(I, 15).Value
          Range(&quot;G&quot; &amp; result) = DT.Cells(I, 12).Value
          Range(&quot;H&quot; &amp; result) = DT.Cells(I, 40).Value
          Range(&quot;I&quot; &amp; result) = DT.Cells(I, 23).Value
          result = result + 1
      End If
  Next I
  </code></pre>