title: How to randomly select number of rows based on conditions in Excel?
body: <p>I want to randomly select 50 rows from one sheet and pasting them in a separate workbook for data sampling. I don't know how to do it because first, I'm new to VBA, I want to learn something new and second, I tried searching this on Google but no accurate answer found.</p>
  
  <p>So what's on my mind is this:</p>
  
  <ol>
  <li><p>I'll get first the number of rows in that worksheet. I've already
  done it with this one line of code:<br>
  <code>CountRows = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row</code></p></li>
  <li><p>Get a random number from 1 to <code>CountRows</code> uniquely. The random numbers should be incremental (1,5,7,20,28,30,50 and no backward counting). Then grab that row, create a new workbook if not yet open and paste it there.</p></li>
  </ol>
  
  <p>How can I achieve this process? I have no idea how to start this.</p>