title: Specifying R1C1 in Excel using Variables in a For...Next Loop
body: <p>I'm trying to run a For Next loop that pulls specific numbers from specific cells in order to calculate total hours for a time card using Excel (it's the best program for what I'm using it for). I cannot, however figure out how to do it because I'm using R1C1 because I'm running the a count for the locations. I am not hidebound to this particular method of doing things, but a variation on it worked in Access (but I can't use Access for this because, reasons).</p>
  
  <p>Attached is the code snippet I'm using.</p>
  
  <pre><code>For Weekday = 11 To 17  'Determine the day of the week by Row Reference (R1C1 format)
      For DayValue = 29 To 34     'Determin time input (Call, Meal In, Meal Out, Wrap, etc.) for day of the week
          WrkTimes(DayValue) = ActiveSheet.Cells.FormulaR1C1 = "R" &amp; (Weekday) &amp; "C" &amp; (DayValue) 'Select the correct time input
      Next DayValue   'Process the next time input    
      TotHrs(Weekday) = WrkTimes(34) - WrkTimes(29) - (WrkTimes(31) - WrkTimes(30)) - (WrkTimes(33) - WrkTimes(32))   'Calculate total hours for the day
      ActiveSheet.Cells(Weekday, 37) = TotHrs(Weekday)    'Display total hours for the day in the proper cell
  </code></pre>
  
  <p>Yes there is a Next command at the bottom of this loop, I just have other non-relevant code between this and the end. I'm getting the error on the DayValue lines</p>