title: excel macro: ByRef argument type mismatch
body: <p>i write a code as follow:</p>
  
  <pre><code>Call search(xx, yy, "APM Output", "&gt;&gt; State Scalars", label1)
  
  label1:
        ...........
  </code></pre>
  
  <p>this the script of Sub search</p>
  
  <pre><code>Sub search(row As Variant, col As Variant, wkst As String, str As String, label_num As Name)
  For row = 1 To 100
    For col = 1 To 100
      strTemp = Worksheets(wkst).Cells(row, col).Value
      If InStr(strTemp, str) &lt;&gt; 0 Then
          GoTo label_num
      End If
    Next
  Next
  End Sub
  </code></pre>
  
  <p>i want to call sub search(..) firstly, and then go to label1.
  The problem is that is says that "ByRef argument type mismatch" for label_num.What should be the correct type for label_num in Sub search(..,..,..,<strong>label_num</strong>)?</p>
  
  <p>i add some original script, these are what I want to convert into a sub()</p>
  
  <pre><code>For xx = 1 To 100
      For yy = 1 To 100
          strTemp = Worksheets("APM Output").Cells(xx, yy).Value
          If InStr(strTemp, "&gt;&gt; State Scalars") &lt;&gt; 0 Then
              GoTo label1
          End If
      Next
  Next
  label1:
      For uu = 1 To 100
          For vv = 1 To 100
              strTemp = Worksheets("APM Output").Cells(uu, vv).Value
              If InStr(strTemp, "&gt;&gt; GPU LPML") &lt;&gt; 0 Then
                  GoTo label2
              End If
          Next
      Next
  label2:
      For mm = 1 To 100
          For nn = 1 To 100
              strTemp = Worksheets("APM Output").Cells(mm, nn).Value
              If InStr(strTemp, "&gt;&gt; Limits and Equations") &lt;&gt; 0 Then
                  GoTo label3
              End If
          Next
      Next
  </code></pre>