Thread: Find and report
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
fgwiii[_2_] fgwiii[_2_] is offline
external usenet poster
 
Posts: 36
Default Find and report

Hello,

When I attempt to run this, I get an Run-time error'9': Subscript out of
range.

Not being sure what to do, I clicked on sheet 2 and then right clicked, view
code, and then pasted the code and ran it (as a macro).

Thanks for your help!

Fred

"Joel" wrote:

Create a worksheet Summary and change the worksheet name that you are
searching in the code below


Sub MakeReport()

RowCount = 1
With Sheets("Sheet1")
Set c = .Cells.Find(what:="m", LookIn:=xlValues, lookat:=xlPart)

If Not c Is Nothing Then
firstAddress = c.Address
Do
With Sheets("Summary")
.Range("A" & RowCount) = c.Value
.Range("B" & RowCount) = c.Address
RowCount = RowCount + 1
End With
Set c = .FindNext(after:=c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With

End Sub


"fgwiii" wrote:

Good morning,

I am trying to find a way to search a spreadsheet that contains several
hundreds of thousands of dates. Searching isn't really the problem, reporting
however is the issue.

What I would like is, to be able to search all of the cells in a worksheet
for a letter such as €śm€ť and then automatically produce a report (worksheet)
that contains all of the values that match that criteria as well as
referencing the header/column letter where the cell was found.

Thank you for your help,

Fred