title: MS Project VBA - Iterate by display row number
body: <p>I have a problem using <code>for</code> loop in this MS Project VBA Macro:</p>
  
  <pre>
  Sub Check_Change_Article()
      Dim ProjTasks As Tasks
      Dim ProjTask As Task
      Dim Art As String
      Dim ArtOld As String
      Set ProjTasks = ActiveProject.Tasks
      ArtOld = " "
      For Each ProjTask In ProjTasks             
      If Not (ProjTask Is Nothing) Then        
          Art =ProjTask.Text22
          If (Art != ArtOld) Then
              ProjTask.Text4 = "CHANGE"
          End If
          ArtOld = Art
      End If
      Next ProjTask
  End Sub
  </pre>
  
  <p>Project Example</p>
  
  <pre>
  Case 1: Sheet when task is open:         
  VBA Row #     TaskID     Text22    Text4 
  1               1        PNL50R    CHANGE
  2               2        PNL50R          
  3               3        JPL50Y    CHANGE
  </pre>
  
  <pre>
  Case 2:  User can filter, group or order tasks (note change in row number)
  VBA Row #     TaskID     Text22    Text4
  1               3        PNL50R    CHANGE
  2               1        PNL50R    CHANGE
  3               2        JPL50Y    
  </pre>
  
  <p>I read this discussion:
  <a href="https://stackoverflow.com/questions/33190730/ms-project-vba-associate-task-with-row">ms project VBA associate task with row</a></p>
  
  <p>Using <code>ActiveSelection.Tasks</code> instead of <code>ActiveProject.Tasks</code> I see that <code>for</code> loop iterates follow VBA Rows.</p>
  
  <p>Is it possible to set for a loop to iterate by VBA Row Number, without using <code>ActiveSelection</code> (if it's possible, I wouldn't force the user to select rows)?</p>
  
  <p>Thanks in advance,
  Giuseppe</p>