title: Find last row of column without including blank cells
body: <p>I have a problem with my code. In the data there are <code>60</code> rows, and in column <code>T</code>, there are <code>57</code> rows which have value i.e that are not blank. Cells <code>58</code>,<code>59</code>,<code>60</code> are blank. I am trying to find the last row for Column <code>T</code>. Whenever I run the code, it always gives me <code>60</code> instead of <code>57</code>.</p>
  <p>Here is my code</p>
  <pre><code>Dim lastrow As Long
  
  lastrow = Cells(Rows.Count, 20).End(xlUp).Row
  
  MsgBox &quot;The Last Row of Data for Column T &quot; &amp; lastrow  
  
  Range(&quot;B2:T&quot; &amp; lastrow).SpecialCells(xlCellTypeVisible).Select
  With Selection.Font
      .Color = -16776961
      .TintAndShade = 0
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Rxs8T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rxs8T.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/0UEuw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0UEuw.png" alt="enter image description here" /></a></p>