View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Grd Grd is offline
external usenet poster
 
Posts: 118
Default Need to find and collect all cells with a certain word onto a

Thanks Barb,

I had a play with this and I see it prints what I want to the Immediates
windows.
Thanks to both you and Gary for the help that I needed.

"Barb Reinhardt" wrote:

You could try something like this. I don't have time to add the sheet or put
it on the sheet. I'm sure someone else can do that for you.

Sub FindWarranty()

Dim WS As Worksheet
Dim myRange As Range
Dim myNewRange As Range


For Each WS In ActiveWorkbook.Worksheets
Set myNewRange = WS.Cells(1, 1)
Do
Set myRange = myNewRange
Set myNewRange = WS.Cells.Find(What:="Warranty", After:=myRange,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If myRange.Address < myNewRange.Address Then
Debug.Print WS.Name, myNewRange.Address, myNewRange.Value
End If
Loop While myRange.Address < myNewRange.Address
Next WS


End Sub
--
HTH,
Barb Reinhardt



"Grd" wrote:

Hi there,

I'm new to macros. Could anyone help me with a macro to search for the word
'warranty' on all the sheets and collect all the cells with the word
'warranty' onto a new sheet.

I'm struggling to do this. It sounds very difficult to too.

Any help greatly appreciated

Thanks

Suzanne