title: Search Bar searching multiple excel sheets macro
body: <p>I have created a search table that will look at two separate sheets to find a specific value.  This was working before but now it will only search the dsheet and not the gsheet.  Any advice will be greatly appreciated. I have added stars to the spot that cause the issue. I have defined my strings, integers, and worksheets. </p>
  
  <pre><code>dsheet.Select
  finalrow = dsheet.Cells(Rows.Count, 1).End(xlUp).Row
  
  
  
  For i = 1 To finalrow
  If IIf(change &lt;&gt; "", Cells(i, 1) = change, True) And IIf(process &lt;&gt; "", Cells(i, 2) = process, True) And IIf(customer &lt;&gt; "", Cells(i, 3) = customer, True) And IIf(material &lt;&gt; "", Cells(i, 4) = material, True) And IIf(number &lt;&gt; "", Cells(i, 5) = number, True) And IIf(vstream &lt;&gt; "", Cells(i, 6) = vstream, True) And IIf(words &lt;&gt; "", InStr(dsheet.Cells(i, 7), words) &gt; 0, True) And IIf(lessons &lt;&gt; "", InStr(dsheet.Cells(i, 8), lessons) &gt; 0, True) And IIf(dday &lt;&gt; "", Cells(i, 10) = dday, True) And IIf(manager &lt;&gt; "", InStr(dsheet.Cells(i, 9), manager) &gt; 0, True) Then
  Range(Cells(i, 1), Cells(i, 10)).Copy
  ssheet.Range("A100").End(xlUp).Offset(1, 0).Resize(1, 10).Value = dsheet.Range(dsheet.Cells(i, 1), dsheet.Cells(i, 10)).Value
  
  
  dsheet.Select
  
  End If
  
  **Next i
  
  
  gsheet.Select
  finalrow2 = gsheet.Cells(Rows.Count, 1).End(xlUp).Row
  
  For j = 1 To finalrow
  If IIf(change &lt;&gt; "", Cells(j, 1) = change, True) And IIf(process &lt;&gt; "", Cells(j, 2) = process, True) And IIf(customer &lt;&gt; "", Cells(j, 3) = customer, True) And IIf(material &lt;&gt; "", Cells(j, 4) = material, True) And IIf(number &lt;&gt; "", Cells(j, 5) = number, True) And IIf(vstream &lt;&gt; "", Cells(j, 6) = vstream, True) And IIf(words &lt;&gt; "", InStr(gsheet.Cells(j, 7), words) &gt; 0, True) And IIf(lessons &lt;&gt; "", InStr(gsheet.Cells(j, 8), lessons) &gt; 0, True) And IIf(dday &lt;&gt; "", Cells(j, 10) = dday, True) And IIf(manager &lt;&gt; "", InStr(gsheet.Cells(j, 9), manager) &gt; 0, True) Then
  Range(Cells(j, 1), Cells(j, 10)).Copy
  ssheet.Range("A100").End(xlUp).Offset(1, 0).Resize(1, 10).Value = gsheet.Range(gsheet.Cells(j, 1), gsheet.Cells(j, 10)).Value
  
  
  gsheet.Select
  
  End If
  
  Next j**
  
  ssheet.Select
  Range("B3").Select
  
  
  With ssheet
      .Protect Password:="QA190", AllowFiltering:=True
      .EnableSelection = xlUnlockedCells
  
  End With
  
  
  End Sub
  </code></pre>