title: Is there a better way to do this? VBA script
body: <p><a href="https://i.stack.imgur.com/NAU4m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NAU4m.png" alt="excel table" /></a></p>
  <p>What I have here is a tracking list, for feeding pumps. We have to account for stock levels, so I made this. When you enter a pump, into the table, nothing happens. When you put a patient's name against it, the row goes pink to indicate the pump has left our stock.</p>
  <p>I was trying to get a script/macro together that could count the pumps that we still had (i.e the white rows, e column), and display the list (table will get quite long in future) to the user.</p>
  <p>My code:</p>
  <p><a href="https://i.stack.imgur.com/NJL7L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NJL7L.png" alt="code" /></a></p>
  <p>It loops through the c column (serial numbers) for each &quot;cll&quot;, an if statement checks if there is anything in the cell 2 columns to the right (patient name, if there is a patient name, it means the pump has been given out) AND if there is a value in the e column (serial numbers). It displays serial numbers that fulfill the criteria in a series of message boxes.</p>
  <p>The code works, and I'm happy to roll it out, as this isn't an overly important issue, and I'll be leaving it with a group of technophobes. However, I'm wondering, it's a little clunky?</p>
  <p>I don't like the seperate message boxes, but I can't find any info on making an array in excel VBA, and I don't like checking the IF using the offset property.</p>
  <p>I couldn't make checking the cll.Interior.color/colorIndex work, as excel seemed to think the cells are all the same color, regardless of what color they actually are. (?conditional formatting causing issues).</p>
  <p>Hope this makes sense,</p>
  <p>EDIT:</p>
  <p>Code as text:</p>
  <pre><code>    Private Sub CommandButton1_Click()
  
  Dim cll As Range
  
  
  For Each cll In Range(&quot;c6:c200&quot;)
  If IsEmpty(cll.Offset(0, 2)) And cll.Value &gt; 0 Then
  MsgBox &quot;Pump Serial number: &quot; &amp; vbNewLine &amp; vbNewLine &amp; cll.Value
  End If
  
  
  Next cll
  
  
  End Sub
  </code></pre>