title: Excel Macro -- return list of items meeting conditions
body: <p>I have a pretty simple excel macro that checks a range of cells for the presence of each value in a reference range of cells.  If a value from the reference range is not found then it displays a message that the value was not found.  The user then has to click okay for the check to continue to the next item.  I would like to modify the macro to check all values and only return a list of those not found after all checks are complete.  Suggestions?</p>
  
  <p>Current code:</p>
  
  <pre><code>Sub ChkAfternoonAssignmentsV2()
      Dim dayToChk As Variant
      Dim i As Variant
      Dim r As Range
      Dim p As Variant
  
  ReEnter:
  
      dayToChk = InputBox("Which day (use 3-letter abbreviation) would you like to check afternoon assignments?")
      If dayToChk = "Mon" Then
          Set r = ActiveSheet.Range("MonAft_MA_Slots")
      ElseIf dayToChk = "Tue" Then
          Set r = ActiveSheet.Range("TueAft_MA_Slots")
      ElseIf dayToChk = "Wed" Then
          Set r = ActiveSheet.Range("WedAft_MA_Slots")
      ElseIf dayToChk = "Thu" Then
          Set r = ActiveSheet.Range("ThuAft_MA_Slots")
      ElseIf dayToChk = "Fri" Then
          Set r = ActiveSheet.Range("FriAft_MA_Slots")
      Else
          MsgBox dayToChk &amp; " is not in the expected format.  Try Mon, Tue, Wed, Thu, or Fri."
          GoTo ReEnter
      End If
  
      Dim AckTime As Integer, InfoBox As Object
      Set InfoBox = CreateObject("WScript.Shell")
      AckTime = 1
      Select Case InfoBox.Popup("Checking MA Assignments", _
      AckTime, "Checking MA Assignments", 0)
      Case 1, -1
      End Select
  
      For Each i In Sheets("Control").Range("MA_List")
          If WorksheetFunction.CountIf(r, i) &lt; 1 Then
              If i &lt;&gt; "OOO" Then
                  MsgBox i &amp; " is not assigned"
              End If
          ElseIf WorksheetFunction.CountIf(r, i) &gt; 1 Then
              If i &lt;&gt; "OOO" Then
                  MsgBox i &amp; " is assigned more than once.  Did you really mean to do that?"
              End If
          End If
      Next i
  </code></pre>