title: Finding max value of a loop with VBA
body: <p>I am trying to find max value of a loop. First, I have two random arrays and I want to find these two arrays correlation coefficient. Then, I want to calculate it multiple times as much as "I3" cell. After that, I want to write a code which finds max correlation coefficient from this calculation. I wrote the code below but it didn't work. </p>
  
  <pre><code>Sub Macro1()
  
  Dim i As Long
  For i = 1 To Range("I3")
      Calculate
  Next
  
  DMax = Application.WorksheetFunction.Max("A2")
  Range("I4").Value = DMax
  
  End Sub
  </code></pre>
  
  <p>Any help is appreciated. </p>