title: Find and Replace VBA with Nested Ifs
body: <p>I'm trying to write a code that replaces text within a formula in a range of cells based on the value in a reference cell. I have the below worked out, but am still running an error. Any advice is much appreciated!</p>
  
  <pre><code>Sub FindRepRegion()
      If Active.Sheet.Range("J1") = "School" Then
          Dim Findtext As String
          Dim Replacetext As String
          Findtext = "'Sheet1'!$B:$B"
          Replacetext = "'Sheet1'!$AW:$AW"
          ActiveSheet.Range("E3:G35").Replace what:=Findtext, replacement:=Replacetext, lookat:=xlPart, MatchCase:=False
      ElseIf Active.Sheet.Range("J1") = "Grant" Then
          Findtext = "'Sheet1'!$AX:$AX"
          Replacetext = "'Sheet1'!$AW:$AW"
          ActiveSheet.Range("E3:G35").Replace what:=Findtext, replacement:=Replacetext, lookat:=xlPart, MatchCase:=False
      ElseIf Active.Sheet.Range("J1") = "Community School" Then
          Findtext = "'Sheet1'!$AY:$AY"
          Replacetext = "'Sheet1'!$AW:$AW"
          ActiveSheet.Range("E3:G35").Replace what:=Findtext, replacement:=Replacetext, lookat:=xlPart, MatchCase:=False
      Else
      End If
  End Sub
  </code></pre>