"find" macro

A

april

i have tried recording a macro using the Find feature. i want to find a line
that contains "net cash provided (used) by operating activities" and delete
it. however, the macro doesn't record the "find" key strokes, only the
delete ones. saw a similiar post on 8/22/07 from Chad and copied his macro
but get error messages.

thanks in advance for your help.

by the way, when i click on the email notification that someone has
responded to my question, i get a blank screen that says "Done" in the bottom
left corner. then i have to go to the web site and try to find my question
and the response. what's going on?

thanks for this too
 
D

Dave Peterson

It recorded fine for me.

But I'm not sure what should happen with that found cell. Does delete mean
delete the entire row or column or clear the cell or just clear the contents of
that cell or what???

This may get you started:

Option Explicit
Sub testme()

Dim FoundCell As Range
Dim myStr As String

myStr = "net cash provided (used) by operating activities"

With ActiveSheet
Set FoundCell = .Cells.Find(What:=myStr, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)

If FoundCell Is Nothing Then
MsgBox "Not found!"
Else
FoundCell.Clear
'or
FoundCell.ClearContents
'or
FoundCell.EntireRow.Delete
End If
End With
End Sub
 
A

april

"delete" means delete the row. i tried several times and couldn't get the
"find" strokes to record.

have just re-tried this. the strokes record if you click "find next" since
there was only one instance of that phrase, i didn't hit "find next"

thanks for your help--
aprilshowers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top