title: Looking for code for matching a string and fetching data in another sheet of same excel using VB
body: <p>I am a beginner in EXCEL and VB script. I have 2 sheets in an excel and want to look for a string in column B of sheet 1, and if it matches, the value from same row but column A should be fetched and displayed in cell D3 of sheet 2 as "The name is _____", where in the blank the fetched value should be displayed. Please help with the code. Thanks.</p>
  
  <p>Tried with below code. Stuck at val2 line, as it is throwing error. Iknow code will have many mistakes, please let me know the mistakes as I just started. Thanks for your help:</p>
  
  <pre><code>Sub to_approve()
  
  Dim val1 As String    
  Dim val2 As String    
  Dim val3 As String    
  Dim k As Integer
  
  For k = 2 To 955    
      Sheets("Sheet1").Activate    
      val1 = "It is good"    
      val2 = Application.WorksheetFunction.Range("B:B").Find(val1, , xlValues, xlWhole)    
  
      If val1 = val2 Then
          val3 = ActiveSheet.Range("A" &amp; k).Value                  
      End If    
  Next k
  
  End Sub
  </code></pre>