title: Error when using target.row in a vba module
body: <p>I am creating an excel 2007 application which uses the exact same VBA code to force uppercase letters in 2 columns. This code is used in 8 different worksheets. I tried to create a subroutine in a module so that I can call the subroutine under each of the 8 worksheets but it isn't working.</p>
  
  <p>When I added the following code directly under each worksheet it worked:</p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  Dim TargetRowNumber  As Integer
  Dim targetColumnNumber As Integer
  
  If (Target.Row &gt;= 6 And Target.Row &lt;= 500) Then
  
      If (Not Intersect(Target, Range("F6:F500")) Is Nothing) Then
        If Target.Column = 6 Then
         Application.EnableEvents = False
         Range("$F" &amp; Target.Row).Value = UCase(Range("$F" &amp; Target.Row).Value)
         Application.EnableEvents = True
        End If
      End If
  
      If (Not Intersect(Target, Range("K6:K500")) Is Nothing) Then
        If Target.Column = 11 Then
          Application.EnableEvents = False
          Range("$K" &amp; Target.Row).Value = UCase(Range("$K" &amp; Target.Row).Value)
          Application.EnableEvents = True
        End If
      End If
  
  end if
  
  end sub
  </code></pre>
  
  <p>But if I create a module with the same code and try to call the subroutine under each of the worksheets I get the following error:  Run-time error '424':  Object required.</p>
  
  <p>Code in Module:</p>
  
  <pre><code>Sub convert_upper()
  Dim TargetRowNumber  As Integer
  Dim targetColumnNumber As Integer
  
  If (Target.Row &gt;= 6 And Target.Row &lt;= 500) Then
  
      If (Not Intersect(Target, Range("F6:F500")) Is Nothing) Then
        If Target.Column = 6 Then
         Application.EnableEvents = False
         Range("$F" &amp; Target.Row).Value = UCase(Range("$F" &amp; Target.Row).Value)
         Application.EnableEvents = True
        End If
      End If
  
      If (Not Intersect(Target, Range("K6:K500")) Is Nothing) Then
        If Target.Column = 11 Then
          Application.EnableEvents = False
          Range("$K" &amp; Target.Row).Value = UCase(Range("$K" &amp; Target.Row).Value)
          Application.EnableEvents = True
        End If
      End If
  
  End If
  
  End Sub
  </code></pre>
  
  <p>Code under each worksheet to call the subroutine:</p>
  
  <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  
     convert_upper
  
  End Sub
  </code></pre>
  
  <p>This is the first time that I have tried to program in vba.  I have tried to find a solution online without success.  I would really appreciate it if someone could help me.</p>
  
  <p>Thank you so much.</p>