Hi,
Try this code:
Sub DeleteCokeRows()
B = ActiveCell.SpecialCells(xlLastCell).Address
For Each c In Range(Cells(1, 1), B)
With c
Set A = .Find("coke", LookIn:=xlFormulas, LookAt:=xlPart,
MatchCase:=False)
End With
If Not A Is Nothing Then Rows(c.Row).EntireRow.Delete
Next c
End Sub
Regards - Dave.
> Date: Tue, 15 Dec 2009 12:40:35 -0800
> Subject: $$Excel-Macros$$ Find and delete rows containing a certain word
> From: [email protected]
> To: [email protected]
>
> Can anyone help me write a macro that will help me find all rows
> containing the word "coke" and delete all of the rows entirely? I'm
> having trouble trying to record something like this. In the end about
> 8,200 rows will be deleted.
> Thanks!
>
> --
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
> http://www.excelitems.com
> 2. Excel tutorials at http://www.excel-macros.blogspot.com
> 3. Learn VBA Macros at http://www.vbamacros.blogspot.com
> 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
>
> To post to this group, send email to [email protected]
> If you find any spam message in the group, please send an email to:
> Ayush Jain @ [email protected] or
> Ashish Jain @ [email protected]
> <><><><><><><><><><><><><><><><><><><><><><>
> HELP US GROW !!
>
> We reach over 6,500 subscribers worldwide and receive many nice notes about
> the learning and support from the group. Our goal is to have 10,000
> subscribers by the end of 2009. Let friends and co-workers know they can
> subscribe to group at http://groups.google.com/group/excel-macros/subscribe
_________________________________________________________________
Get more out of Hotmail Check out the latest features today
http://windowslive.ninemsn.com.au/hotmail/article/878466/your-hotmail-is-about-to-get-even-better
--
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain @ [email protected] or
Ashish Jain @ [email protected]
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!
We reach over 6,500 subscribers worldwide and receive many nice notes about the
learning and support from the group. Our goal is to have 10,000 subscribers by
the end of 2009. Let friends and co-workers know they can subscribe to group at
http://groups.google.com/group/excel-macros/subscribe