title: VBS Excel Trying to select past empty cells in a macro
body: <p>I'm currently trying to create a macro that will make a selection based on a few criteria. However, I am running into problems when it comes to selecting all data to the right of a current point due to certain cells being empty.</p>
  
  <p>So far I have something like this:</p>
  
  <pre><code>rwcnt = WorksheetFunction.CountA(Range("A:A"))
  lastc = Cells(1, Columns.Count).End(xlToLeft).Column
  Dim i As Long
  
  
  For i = 2 To rwcnt
      If IsNumeric(Cells(i, 1).Value) &lt;&gt; True Then
          Range(Cells(i, 1).Address, Cells(i, 1).End(xlDown).Address).Select
          Range(Selection, lastc).Select
          Exit For
      End If
  Next
  </code></pre>
  
  <p>This gives me an error method 'range' of object '_global' failed</p>
  
  <p>previously, I had the last range line reading as:</p>
  
  <pre><code>Range(Selection, Selection.End(xlToRight)).Select
  </code></pre>
  
  <p>I tried this as I am starting from the left, however, some rows have blank cells which is where the selection would get stopped. Because of this I am trying to make a way to come in from the right and find my last column and then select to that. Any help would be greatly appreciated!</p>