title: How do I get the row number of a range in Excel?
body: <p>I want to get the row number of a range in Excel, but I can't manage to find a way how to get it. I'm using the following code:</p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
      Dim nr As Integer
      Set nr = Target.Row
  End Sub
  </code></pre>
  
  <p>When I run it I get: <strong>Compile error: Object required</strong></p>
  
  <p>I also tried to replace Target.Row with the following:</p>
  
  <pre><code> Target.Cells(1, 1).End(xlUp).Row
   Target.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
   Target.End(xlUp).Row
   Target.Offset(0, 0).Row
  </code></pre>
  
  <p>But none of these seem to work either :(</p>
  
  <p>Does anyone have any idea as to what's causing the error?</p>