title: Need to correct VBA code. Getting error message."For Control Variable already in use"
body: <p>Im using VBA in Excel.</p>
  
  <p>Im getting an error message saying control variable already in use. When the error pops up the second <strong>For Each r In</strong> is highlighted in the VBA editor.Can anyone help correcting this code. Thank you</p>
  
  <pre><code>Dim ws As Worksheet
  Dim r As Range
  
  For Each ws In Worksheets
      If InStr(1, ws.Name, "Wk", 1) &gt; 0 Then
          For Each r In ws.Range("C118:I124")
          For Each r In ws.Range("C163:J168")
          For Each r In ws.Cell(E2, E15, E28, E41, E54, E67, E80)
              r.Formula = Replace(r.Formula, "Wk1", r.Parent.Name)
          Next r
      End If
  Next ws
  
  MsgBox "Done"
  End Sub
  </code></pre>