title: VBA xlUp does not select the range correctly
body: <p>I am trying to copy a range of values from column L i.e. from L2 until the last cell (supposed to vary each time) that contains a value. Once I succeed with column L, I would like to repeat this action for many other columns. Since column L has some blank cells in between, I have used xlUp. The problem is that the selection does not stop at the last cell with value, but goes until the row number 2542. This time the last cell should have been 542. All the rows in between 542 and 2542 seem to be blank- I even tried deleting and clearing those rows to make sure that there is really nothing in them. But that doesn't seem to help. Below is the code I tried.</p>
  <p>Any help is greatly appreciated.</p>
  <pre><code>Call CopyRangeAndPasteAt(&quot;L2&quot;, &quot;AE2&quot;, True)
  
  Function CopyRangeAndPasteAt(SrcRange As String, DestIdx As String, Trans As Boolean)
      
      Sheet2.Select
      LastRow = Sheet2.Range(&quot;L&quot; &amp; Rows.Count).End(xlUp).Row
  
      Range(Range(SrcRange), Range(SrcRange &amp; LastRow)).Select
      Selection.Copy
      Sheet6.Select
      Range(DestIdx).Select
      Selection.PasteSpecial Paste:=xlPasteValues  
  
  End Function
  </code></pre>