title: VBA : Sub or Function Not Defined Compiler Error While Using Search
body: <p>I am very much stuck , i tied searching but i am not getting satisfactory solution  </p>
  
  <h3>Below is my code</h3>
  
  <pre><code>Dim i As Integer    
  Dim k As Integer    
  Dim Values As String    
  Dim x As String
  
  Worksheets("Pivot").Activate
  
  Values = Range("B3").Value    
  'Values = Mid(Values, 5, 16)    
  'k = Search("|", Values)
  
  x = Mid(Value, Search("|", Value) + 1, Search("|", Value, Search("|", Value) + 1) - Search("|", Value) - 1)))
  
  MsgBox "" &amp; x
  </code></pre>
  
  <h3>Note :</h3>
  
  <p>The Error is "Sub or Function not defined " , I am getting this compiler error only if i use search formula , when i use Mid formula (the one that is commented i am not getting the error " anyone has any solution that can help me . 
  In the Code i am trying to extract the string contained in a cell between occurrence of "|" contained in the entire string in the  cell .</p>