Try this
Sub atm()
Dim strItem As String
Dim Keyword As String
Dim a As Long, m As Long
Keyword = InputBox("Enter String to Find", "Extract String", "ATM")
Keyword = LCase(Keyword)
Range("a6:l300").ClearContents
m = 6
For n = 1 To 12 ' months
For a = 6 To 36 ' range of each sheet
If LCase(Sheets(n).Cells(a, 2).Value) Like "*" & Keyword & "*" Then
strItem = LCase(Sheets(n).Cells(a, 2).Value)
strItem = Mid(strItem, InStr(strItem, Keyword))
If InStr(1, strItem, Chr(10)) > 0 Then
strItem = Left(strItem, InStr(1, strItem, Chr(10)) - 1)
End If
Sheets(14).Cells(m, n).Value = "Date: " & Sheets(n).Cells(a, 1) & Chr(10) & strItem
m = m + 1
End If
Next
Next
End Sub
This will return the result in lower case (for the search string)
If you want the result in upper case then change this line
Sheets(14).Cells(m, n).Value = "Date: " & Sheets(n).Cells(a, 1) & Chr(10) & strItem
to
Sheets(14).Cells(m, n).Value = "Date: " & Sheets(n).Cells(a, 1) & Chr(10) & Ucase(strItem)
If you want proper case you will need to use WorksheetFunction.Proper()
Sheets(14).Cells(m, n).Value = "Date: " & Sheets(n).Cells(a, 1) & Chr(10) & WorksheetFunction.Proper(strItem)
Hope this helps
Bookmarks