title: Find and Replace for Named Ranges
body: <p>For some reason the Replace Function I have in this Macro doesn't if i change the value of the for YTD and YTG to ",9," and ",12," the Macro won't work. Here is what I have.</p>
  
  <pre><code>  Sub Rename()
     Dim YTG As String
     Dim YTD As String
     Dim Shiftold As String
     Dim Shitnew As String
  
  i = 1
  
  YTG = "&lt;&gt;YTG"
  YTD = "YTD"
  Shiftold = "0,0,1"
  ShiftNew = "0,12,1"
  
  
  For Each Name In ActiveWorkbook.Names
      If InStr(1, Names(i).RefersTo, YTG) &gt; 0 Then
      Names(i).RefersTo = Replace(Names(i).RefersTo, YTG, YTD)
      End If
  
      If InStr(1, Names(i).RefersTo, Shiftold) &gt; 0 Then
      Names(i).RefersTo = Replace(Names(i).RefersTo, Shiftold, ShiftNew)
      End If
  
      i = i + 1
  Next Name
  End Sub
  </code></pre>
  
  <p>Any thoughts on why the macro doesn't work anymore?</p>