title: Excel VBA - Loop through a column of cells and search for each cell value in the workbook
body: <p>I need to create a macro that loops through a list of selected cells containing strings and takes each string and searches the entire workbook for that string. If the string is found, the sub should exit and the found string should be selected otherwise move on to the next string to be found until the end of the list.</p>
  
  <p>When I run my code the sub does not exit when a string in the list is found and it does not go to that cell.</p>
  
  <pre><code>Option Explicit
  
  Dim sheetCount As Integer
  Dim datatoFind
  
  Sub Button1_Click()
  
  Find_File
  
  End Sub
  
  Private Sub Find_File()
  Dim c As Range
  Dim counter As Integer
  Dim currentSheet As Integer
  Dim notFound As Boolean
  notFound = True
  
  For Each c In Selection.Cells
      On Error Resume Next
      currentSheet = ActiveSheet.Index
      datatoFind = StrConv(c.Value, vbLowerCase)
      If datatoFind = "" Then Exit Sub
      sheetCount = ActiveWorkbook.Sheets.Count
      If IsError(CDbl(datatoFind)) = False Then datatoFind = CDbl(datatoFind)
      For counter = 1 To sheetCount
          Sheets(counter).Activate
          Cells.Find(What:=datatoFind, After:=ActiveCell, LookIn:=xlValues, LookAt _
          :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
          False, SearchFormat:=False).Activate
          If InStr(1, StrConv(ActiveCell.Value, vbLowerCase), datatoFind) Then
              notFound = False
              Sheets(counter).Activate
              Range("datatoFind").Select
              Exit For
          End If
      Next counter
      If notFound = True Then
          MsgBox ("Value not found")
          Sheets(counter).Activate
      Else
          Exit Sub
      End If
  Next c
  End Sub
  </code></pre>
  
  <p>Any help is much appreciated!</p>