title: Improving Management of already run groups in Email Macro
body: <p>Built a routine that runs through a list of business done for the day and sends email pdfs to each customer for each purchase they made.  Everything is working fine, but the way I keep track of what customers have been sent to is a bit ghetto and I wanted to see what the best way to do it was.</p>
  
  <p>Currently I am using columns 40 and 41 in sheet "emailMaster" and printing in those cells each time a firm or separate employee is run using code similar to this <code>Set firmAlreadyRun = emailMaster.Columns(40).Find(What:=firmName, LookAt:=xlWhole)</code>.  The sheet it's printing to is an actively read sheet and while these columns are fairly far away from everything; you still run the risk of data crossing over or it not being cleared out properly after an error, etc.  Can an array be used for this? (two arrays in this case?)</p>
  
  <p><strong>Things To Note:</strong> <strong>1)</strong> The case statement <code>Select Case empSeparate</code> is to handle certain firms that require individual employees to receive PDFs for their own purchases.  So if the firm requires separation it either searches the firm column or the employee column. <strong>2)</strong> There are multiple firm names that are stored into the row so it prints <code>cFirm</code> and <code>iFirm</code> and <code>tFirm</code>, which are just representing different entity names. <strong>3)</strong> The routine runs through the entire list of firms each time to check for multiple receipts and then increments down another row and starts from there.  This is not directly related to the question, but that's why it needs to check if the firm or employee has already been run. <strong>4)</strong> There is a lot more code not shown so if something isn't clear and i'm forgetting to mention it please just let me know.  <strong>5)</strong> Yes, I turn <code>Application.ScreenUpdating = True</code> a bit lower ;)  <strong>6)</strong> Resets after each session so it does not need to be consistent across executions of the macro.  <strong>Code Below</strong></p>
  
  <p><strong>Tests for existence of firms or employees in the "memory" columns</strong></p>
  
  <pre><code>'Filters out firms that have already been run and accounts for separate emps in order to check for already run.
      Select Case empSeparate
  
          Case False
              Set firmAlreadyRun = emailMaster.Columns(40).Find(What:=firmName, LookAt:=xlWhole)
  
              If Not firmAlreadyRun Is Nothing Then
                  GoTo Skip
              End If
  
          Case True
              Set empAlreadyRun = emailMaster.Columns(41).Find(What:=empName, LookAt:=xlWhole)
  
              If Not empAlreadyRun Is Nothing Then
                  GoTo Skip
              End If
  
      End Select
  </code></pre>
  
  <p><strong>Copies firm names and employee names to the rows</strong></p>
  
  <pre><code>'Stores names for memory purposes so multiple emails are not reprinted.  Could probably do this with an Array, but will come back later
      Application.ScreenUpdating = False
      memoryRowManager = memoryRowManager + 1
      emailMaster.Cells(memoryRowManager, 40) = cFirm
      emailMaster.Cells(memoryRowManager, 41) = empName
      memoryRowManager = memoryRowManager + 1
      emailMaster.Cells(memoryRowManager, 40) = iFirm
  
      If IsEmpty(tFirm) = False Then
          memoryRowManager = memoryRowManager + 1
          emailMaster.Cells(memoryRowManager, 40) = tFirm
          emailMaster.Cells(memoryRowManager, 41) = empName
      End If
  </code></pre>