title: Run Time Error '1004', have researched and tried several recommended solutions to no avail
body: <p>I am trying to fill a range with a formula and continue to get a runtime error '1004'. The error occurs at the line I have starred <strong>Sheets("Forecast").Range("H125").Formula = formulaTest</strong>. The code in my Sub is as follows:</p>
  
  <pre><code>Sub FirmShareFill()
  
  Dim RampUp As Range
  Dim RampBas As Range
  Dim RampDn As Range
  Dim Numbering As Range
  Dim Approval As Range
  Dim PeakShare As Range
  
  
  
  Dim tcount As Byte
  Dim bcount As Byte
  Dim ubdcount As Byte
  Dim yearRange2 As Byte
  
  year = Worksheets("Inputs").Range("B6").Value
  cntry = Worksheets("Inputs").Range("B5").Value
  bnd = Worksheets("Inputs").Range("B3").Value
  typ = Worksheets("Inputs").Range("B2").Value
  cat = Worksheets("Inputs").Range("B4").Value
  
  tcount = bnd * cat + bnd
  ubdcount = tcount * 2 + 1
  yearCount = year * 4 - 1
  
          For ubd = 1 To 3
          For t = 1 To typ
          For b = 1 To bnd
          For c = 1 To cat
          For i = 1 To cntry
  
          Set RampUp = Columns(7).Find(What:="Ramp_Up" &amp; i, MatchCase:=True).Offset(0, 1)
          Set RampBas = Columns(7).Find(What:="Ramp_Bas" &amp; i, MatchCase:=True).Offset(0, 1)
          Set RampDn = Columns(7).Find(What:="Ramp_Dn" &amp; i, MatchCase:=True).Offset(0, 1)
  
          Set Numbering = Sheets("Inputs").Range("B13")
          Set Approval = Columns(6).Find(What:="Approval", MatchCase:=True).Offset(i, 2 + ubd)
  
  
          bcount = c + (cat + 1) * (b - 1)
  
          If t = 1 And b = 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c)
          ElseIf t = 1 And b &gt; 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, bcount)
          ElseIf t &gt; 1 And b = 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, c + tcount)
          ElseIf t &gt; 1 And b &gt; 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, tcount + bcount)
  
          ElseIf t = 1 And b = 1 And ubd = 2 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c + ubdcount)
          ElseIf t = 1 And b &gt; 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, bcount + ubdcount)
          ElseIf t &gt; 1 And b = 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, c + tcount + ubdcount)
          ElseIf t &gt; 1 And b &gt; 1 And ubd = 1 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, tcount + bcount + ubdcount)
  
          ElseIf t = 1 And b = 1 And ubd = 3 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c + 2 * ubdcount)
          ElseIf t = 1 And b &gt; 1 And ubd = 3 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, bcount + 2 * ubdcount)
          ElseIf t &gt; 1 And b = 1 And ubd = 3 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, c + tcount + 2 * ubdcount)
          ElseIf t &gt; 1 And b &gt; 1 And ubd = 3 Then
              Set PeakShare = Columns(5).Find(What:="Peak Share" &amp; c, MatchCase:=True).Offset(4 + i, tcount + bcount + 2 * ubdcount)
          End If
  
          Dim formulaTest As String
  
          formulaTest = "=IF(" &amp; Numbering.Address(False, False) &amp; "&lt;" &amp; Approval.Address &amp; ","", " &amp; PeakShare.Address &amp; " * " &amp; RampUp.Address &amp; ")"
  
          If ubd = 1 Then
          **Sheets("Forecast").Range("H125").Formula = formulaTest**
          ActiveCell.Offset(1, 0).Select
  
          ElseIf ubd = 2 Then
          Range(ActiveCell, ActiveCell.Offset(0, yearRange2)).Formula = "=IF(" &amp; Numbering.Address(False, False) &amp; " &lt; " &amp; Approval.Offset(1, 0).Address &amp; ","", " &amp; PeakShare.Address &amp; " * " &amp; RampBas.Address &amp; ""
  
          ElseIf ubd = 3 Then
          Range(ActiveCell, ActiveCell.Offset(0, yearRange2)).Formula = "=IF(" &amp; Numbering.Address(False, False) &amp; " &lt; " &amp; Approval.Offset(1, 0).Address &amp; ","", " &amp; PeakShare.Address &amp; " * " &amp; RampDn.Address &amp; ""
  
          End If
  
  
          Next i
  
          ActiveCell.Offset(1, 0).Select
  
          Next c
          Next b
          Next t
          Next ubd
  
  
  
  End Sub
  </code></pre>
  
  <p>I believe the error may have something to do with how I declared the range "numbering" range, but as of yet I have been unable to figure it out. I have used this code on the same sheet many times, the only difference being that I have set a range, numbering, on a different sheet. </p>