title: find row number for matching value and store in variable
body: <p>Based on an input value I want to find the cell in a table, and store the row number in a variable. This variable will be used to multiply the corresponding values in the next columns with the input number. My code so far:</p>
  
  <pre><code>Option Explicit
  
  Sub Calculate()
  
  Dim var As Variant
  Dim rownumber As Integer
  Dim Mx As Variant
  Dim Nx As Variant
  Dim Ox As Variant
  Dim Px As Variant
  Dim Qx As Variant
  Dim Rx As Variant
  Dim low As Variant
  Dim cat As Variant
  
  rownumber = WorksheetFunction.Match(Sheets("User Interface").Range("K27").Value, Sheets("C-type").Range("L5:L345"), 0)
  
  
  Mx = Sheets("User Interface").Range("K27").Value * Sheets("C-type").Range("M" &amp; rownumber).Value
  Nx = Sheets("User Interface").Range("K27").Value * Sheets("C-type").Range("N" &amp; rownumber).Value
  Ox = Sheets("User Interface").Range("K27").Value * Sheets("C-type").Range("O" &amp; rownumber).Value
  Px = Sheets("User Interface").Range("K27").Value * Sheets("C-type").Range("P" &amp; rownumber).Value
  Qx = Sheets("User Interface").Range("K27").Value * Sheets("C-type").Range("Q" &amp; rownumber).Value
  Rx = Sheets("User Interface").Range("K27").Value * Sheets("C-type").Range("R" &amp; rownumber).Value
  
  cat = Array(Mx, Nx, Ox, Px, Qx, Rx)
  
  low = Application.WorksheetFunction.Min(cat)
  
  Sheets("User Interface").Range("C45").Value = low
  
  Sheets("User Interface").Range("c45").Activate
  Application.Goto ActiveCell.EntireRow, True
  
  End Sub
  </code></pre>
  
  <p>The problem is that I get subscript out of range-error on my match function, thus I'm starting to doubt that this is the correct way to go about it. I need to somehow be able to reference the row number of the matching number in the table, any suggestions would be highly appreciated.</p>