title: Portion of code (VBA) being skipped
body: <p>I have a custom application developed in and for MS Project.  As it's executing one of its functions it's skipping over a portion of code resulting in an incorrect output.  Below is the line of code causing the error and forcing the application to skip ahead. Anyone know what could be causing it?</p>
  
  <pre><code>FilterEdit Name:="fCriteria", TaskFilter:=True, Create:=True, _
      OverwriteExisting:=True, FieldName:="Flag20", test:="equals", _
      Value:="No", ShowInMenu:=False, ShowSummaryTasks:=True 
  </code></pre>
  
  <p>Here is the entire sub routine</p>
  
  <pre><code>If keepCriteriaCount &gt; 0 And globRemProducts = True Then
      Application.ScreenUpdating = False
       WindowActivate WindowName:=globNewWindow
       TableApply Name:="Master Template"
   FilterApply Name:="All Tasks"
   Application.SetAutoFilter FieldName:="Flag20", FilterType:=pjAutoFilterClear
  
     SelectSheet
      SetTaskField Field:="Flag20", Value:="No"
      SelectTaskField Row:=0, Column:="Flag20", Height:=0
      EditCopy
      SelectTaskColumn Column:="Flag20"
      FillDown
  
              keepCriteriaArray() = Split(keepCriteria, ",")
              fCount = 0
  
              'Remove Tasks for excluded Products
  
                      For dCriteria = LBound(keepCriteriaArray) To UBound(keepCriteriaArray)
                          If Not keepCriteriaArray(dCriteria) = "" Then
                              If Len(Trim(keepCriteriaArray(dCriteria))) = 2 Then
                                  projChannels = Trim(keepCriteriaArray(dCriteria)) &amp; ","
                              Else
                                  projChannels = Trim(keepCriteriaArray(dCriteria))
                              End If
                              If fCount = 0 Then
                                  FilterEdit Name:="fCriteria", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Text24", test:="contains", Value:=projChannels, ShowInMenu:=False, ShowSummaryTasks:=False
                                  FilterEdit Name:="fCriteria", TaskFilter:=True, FieldName:="", NewFieldName:="Text24", test:="contains", Value:="All", Operation:="OR", ShowSummaryTasks:=False
                                  fCount = fCount + 1
                              Else
                                  projChannels = Trim(keepCriteriaArray(dCriteria))
                                  FilterEdit Name:="fCriteria", TaskFilter:=True, FieldName:="", NewFieldName:="Text24", test:="contains", Value:=projChannels, Operation:="OR", ShowSummaryTasks:=False
                              End If
                          End If
  
  
                      Next dCriteria
  
              FilterApply Name:="fCriteria" ' apply the filter
              SelectSheet
              tCount = ActiveSelection.Tasks.Count
                  SelectSheet
                  SetTaskField Field:="Flag20", Value:="Yes"
                  SelectTaskField Row:=0, Column:="Flag20", Height:=0
                  EditCopy
                  SelectTaskColumn Column:="Flag20"
                  FillDown
               FilterApply Name:="All Tasks"
               Application.SetAutoFilter FieldName:="Flag20", FilterType:=pjAutoFilterClear
                If addCriteriaCount = 0 Then
                      tCriteria = projChannels &amp; "; " &amp; globStoreChannels &amp; "; " &amp; txtCustType.Value
                  Else
                      tCriteria = addCriteria &amp; ", " &amp; projChannels &amp; "; " &amp; globStoreChannels &amp; "; " &amp; txtCustType.Value
                  End If
      'WindowActivate WindowName:=globNewWindow
  
  
      TableApply Name:="Master Template"
      tskHeaderRow = 1
  
  
      SelectTaskField Row:=tskHeaderRow, Column:="Text4"
      SetTaskField Field:="Text4", Value:=tCriteria
  
               'before you delete - outdent all tasks
               SelectSheet
  
              For rLevel = ActiveSelection.Tasks.Count To 1 Step -1
  
                      SelectTaskField Row:=rLevel, Column:="Name", RowRelative:=False
                      OutlineOutdent
                      OutlineOutdent
                      OutlineOutdent
                      OutlineOutdent
              Next rLevel
  
                  'If Not ActiveProject.AutoFilter Then Application.AutoFilter
                  'Group
                  On Error Resume Next
                  'Application.SetAutoFilter FieldName:="Flag20", FilterType:=pjAutoFilterCustom, Test1:="contains", Criteria1:="No"
                  FilterEdit Name:="fCriteria", TaskFilter:=True, Create:=True, OverwriteExisting:=True, FieldName:="Flag20", test:="equals", Value:="No", ShowInMenu:=False, ShowSummaryTasks:=True
                  FilterApply Name:="fCriteria" ' apply the filter
                  SelectSheet
                  On Error GoTo removeErr
                  If ActiveSelection.Tasks.Count &gt;= 1 Then
  
                      SelectSheet
                          EditDelete
  
                  End If
  </code></pre>