title: Loop dilemma, different approach same result
body: <p>I was trying to trigger worksheet event by changing content of a cell. I know my code has the wrong approach (I should used redim,...), but result is the same. Is it OK to solve problems as you like or is there the right way to do things in programming?</p>
  <pre><code>'I condition
  For Each cell In rng
      If cond1 = &quot;&quot; Then
          arr(i) = cell.Row
          i = i + 1
      Else
          If cell.Offset(0, 4).Value = cond1 Then
              arr(i) = cell.Row
              i = i + 1
          End If
      End If
  Next
  
  'II condtion
  For a = LBound(arr) To UBound(arr)
      If cond2 = &quot;&quot; Then
          GoTo X
      Else
          If arr(a) &lt;&gt; &quot;&quot; Then
              If wsDB.Cells(arr(a), 5).Value &lt;&gt; cond2 Then
                  arr(a) = &quot;&quot;
              End If
          End If
      End If
  Next a
  X:
  
  b = 9
  For i = LBound(arr) To UBound(arr)
      If arr(i) &lt;&gt; &quot;&quot; Then
          If b &gt; 150 Then
              Exit Sub
          Else
              ws.Cells(b, 3).Value = wsDB.Cells(arr(i), 3).Value
              b = b + 1
          End If
      End If
  Next i
  
  End Sub
  </code></pre>