Find cells containing "Total"
Give this a try...
Sub FindTotal()
Dim wks As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim rngFoundAll As Range
Dim strFirstAddress As String
Set wks = Sheets("Sheet1")
Set rngToSearch = wks.Cells
Set rngFound = rngToSearch.Find(What:="Total", _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Total was not found."
Else
Set rngFoundAll = rngFound
strFirstAddress = rngFound.Address
Do
Set rngFoundAll = Union(rngFound, rngFoundAll)
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirstAddress
rngFoundAll.Select
End If
End Sub
--
HTH...
Jim Thomlinson
"cottage6" wrote:
Hello all,
How can I find all cells with the word "Total" included in the cell? For
example, one of the cells is "6/3/2006 Total", with "Total" always being the
last 5 characters. I've tried several things but nothing's worked. Can
anyone help? TIA
|