title: How to get in VBA the max value of the cells in the row range 2:60 and column range D:H
body: <p>I am having an Excel sheet with integer values in 60 rows and in 7 columns. First row is the commentaire, and first three columns are the commentaires as well (I have to ommit those).</p>
  
  <p>So, I would like to iterate through the row range 2:60 in column range 3:7 (D:H) to find the max value of the celles in a row. Answer goes to the celles in the column I.</p>
  
  <p>What I have (simplified view):</p>
  
  <pre>
         Test1  Test2  Test3  Test4
  One    1      2      3      4
  Two    5      6      7      8
  Three  1      2      5      4
  Four   1      7      3      4
  </pre>
  
  <p>What I would like to have:</p>
  
  <pre>
         Test1  Test2  Test3  Test4  Max
  One    1      2      3      4      4
  Two    5      6      7      8      8
  Three  1      2      5      4      5 
  Four   1      7      3      4      7
  </pre>
  
  <p>If I create a macro manually, I receive this:</p>
  
  <pre><code>range("D2:I2").Select
  range("I2").Activate
  ActiveCell.FormulaR1C1 = "=MAX(RC[-5]:RC[-1])"
  
  range("D3:I3").Select
  range("I3").Activate
  ActiveCell.FormulaR1C1 = "=MAX(RC[-5]:RC[-1])"
  
  range("D4:I4").Select
  range("I4").Activate
  ActiveCell.FormulaR1C1 = "=MAX(RC[-5]:RC[-1])"
  </code></pre>
  
  <p>Cool... but I would like to iterate through that with a loop. </p>
  
  <p>I tried this, but doesnt work:</p>
  
  <pre><code>Sub max()
      For num = 2 To 4
          range("D&amp;num:I&amp;num").Select
          range("I &amp; num").Activate
          ActiveCell.FormulaR1C1 = "=MAX(RC[-5]:RC[-1])"
      Next num
  End Sub
  </code></pre>
  
  <p>Any ideas ?</p>