title: INDEX/MATCH MAX vba
body: <p>My question is about finding the student name from range (D2:D296) who contains the highest value from range(N2:N296). I have done the below code and could not execute well.
  My bad, I did not mentioned earlier about that my datas are from diff worksheet which is Sheet1.</p>
  
  <p>Sub highestmark()</p>
  
  <pre><code>Dim Result As Long
  Dim rng As range
  Dim rnng As range
  
  
  Set rng = ThisWorkbook.Worksheets("Sheet1").range("$N$2:$N$296")
  Set rnng= This Workbook.Worksheets("Sheet1").range("$D$2:$D$296")
  Result = Index(rnng, Match(Max(rng), rng))
  
  [B3] = Result
  </code></pre>
  
  <p>End Sub</p>
  
  <p>Im kinda new to vba, i appreciate the comments earlier, again, my bad that i didnt write it down clearer just now and my bad that i write weird codes.</p>