title: 1004 Error - Dynamically Assigning Formula to a Range of Cells
body: <p>I am trying to dynamically set the cell that a formula is entered in when my macro is executed.  This block of code will be looped through about 10 times, each with a new section of employees. Ordered by department. So as the loop comes back to this point the first cell will change.</p>
  
  <p>I get this error: </p>
  
  <blockquote>
    <p>Method 'Range' of object '_Global' failed</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>'Select the top cell in the "%Working" Column
  
  Range(Cells(StartTemp, 9)).Select
  
  'Insert the Formula - Billable/(Billable + Unbillable) * 100 into Column I for each section
  'Formula is 'C4/(C4+C5)*100
  
  Range(Cells(StartTemp, 9)).Formula = "=RC[-6]/(RC[-6]+RC[-5]) *100" 
  Range(Cells(StartTemp, 9)).Select
  Selection.NumberFormat = "0.00%"
  
  'Insert the Formula into all cells in the section for this group.
  
  Selection.AutoFill Destination:=Range(Cells(StartTemp, 9), Cells(EndTemp, 9)), Type:=xlFillDefault    
  
  Range(Cells(StartTemp, 9), Cells(EndTemp, 9)).Select
  </code></pre>
  
  <p>Thanks in advance!</p>