title: How Do I Find The Cells With Contiguous Data In A Row In Excel VBA?
body: <p><a href="https://i.stack.imgur.com/O4U2m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/O4U2m.png" alt="alt text"></a>
  </p>
  
  <p>Given the Image... If I know that there is some data starting at Range("B3").<br>
  How can I find the cells with contiguous data that is till cell E3? Since F3 is blank G3 onwards should not be considered.
  The result could either be a range object (B3:E3) or count of cells( 4 in this case).</p>
  
  <p>By setting B3 as the Active cell and doing..  </p>
  
  <pre><code>Range(ActiveCell, ActiveCell.End(xlToRight).Count
  </code></pre>
  
  <p>I do get the count, however this method is not reliable, in case only B3 has data it counts the cells till the end of the sheet.<br>
  Of course this could also be achieved by looping through the cells but I'd rather use a Worksheet Function or some other efficient method.</p>