<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Delete entire ROW if a cell contains a phrase' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Delete entire ROW if a cell contains a phrase' posted on the 'VBA' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Wed, 19 Jun 2013 01:53:59 -0700</pubDate>
    <lastBuildDate>Wed, 19 Jun 2013 01:53:59 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Delete entire ROW if a cell contains a phrase</title>
      <link>http://www.programmersheaven.com/mb/vba/382436/382436/delete-entire-row-if-a-cell-contains-a-phrase/</link>
      <description>I am trying to write a small piece of code for an Excel macro.  I am working with some ladies here who use an excel spreadsheet to export some of the numbers from their system to their customer.&lt;br /&gt;
&lt;br /&gt;
I need a quick macro that can examine each line of the .xls file and if a certain phrase appears in a cell (for instance, any cell in column C) then have it delete that entire line.&lt;br /&gt;
&lt;br /&gt;
Additionally, if another macro (or maybe even an extension of the first macro, but it may be easier to have two separate macros) that could look at another row, like row FIVE, and if it contains all zeros for cells D-AA (or whatever it goes to) then I would like to have it remove that entire row if it has nothing but zeros from a certain cell over.&lt;br /&gt;
&lt;br /&gt;
Any help would be greatly appreciated.  I haven't had the privilege to work much with Excel with regards to creating macros and such.&lt;br /&gt;
&lt;br /&gt;
Thanks in advance!&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/vba/382436/382436/delete-entire-row-if-a-cell-contains-a-phrase/</guid>
      <pubDate>Mon, 01 Dec 2008 10:53:56 -0700</pubDate>
      <category>VBA</category>
    </item>
    <item>
      <title>Re: Delete entire ROW if a cell contains a phrase</title>
      <link>http://www.programmersheaven.com/mb/vba/382436/382458/re-delete-entire-row-if-a-cell-contains-a-phrase/#382458</link>
      <description>Hi&lt;br /&gt;
&lt;br /&gt;
Here is a simple one that checks for certain text (Beauty) in column C of the current sheet and deletes the entire row if it is found&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;Sub DeleteRow()
    Dim i1 As Long
    Dim iMax As Long
    Dim sText As String
    
    sText = "Beauty"
    sText = LCase(sText)
    iMax = Cells.SpecialCells(xlCellTypeLastCell).Row
    
    For i1 = iMax To 1 Step -1
        If InStr(1, LCase(Cells(i1, 3)), sText) &amp;lt;&amp;gt; 0 Then
            Rows(i1).EntireRow.Delete
        End If
    Next i1
    

End Sub&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Cheers&lt;br /&gt;
Shasur&lt;br /&gt;
&lt;br /&gt;
: I am trying to write a small piece of code for an Excel macro.  I am &lt;br /&gt;
: working with some ladies here who use an excel spreadsheet to export &lt;br /&gt;
: some of the numbers from their system to their customer.&lt;br /&gt;
: &lt;br /&gt;
: I need a quick macro that can examine each line of the .xls file and &lt;br /&gt;
: if a certain phrase appears in a cell (for instance, any cell in &lt;br /&gt;
: column C) then have it delete that entire line.&lt;br /&gt;
: &lt;br /&gt;
: Additionally, if another macro (or maybe even an extension of the &lt;br /&gt;
: first macro, but it may be easier to have two separate macros) that &lt;br /&gt;
: could look at another row, like row FIVE, and if it contains all &lt;br /&gt;
: zeros for cells D-AA (or whatever it goes to) then I would like to &lt;br /&gt;
: have it remove that entire row if it has nothing but zeros from a &lt;br /&gt;
: certain cell over.&lt;br /&gt;
: &lt;br /&gt;
: Any help would be greatly appreciated.  I haven't had the privilege &lt;br /&gt;
: to work much with Excel with regards to creating macros and such.&lt;br /&gt;
: &lt;br /&gt;
: Thanks in advance!&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
VBA Tips &amp;amp; Tricks (&lt;a href="http://vbadud.blogspot.com"&gt;http://vbadud.blogspot.com&lt;/a&gt;)&lt;br /&gt;
&lt;br /&gt;
C# Code Snippets (&lt;a href="#"&gt;http:dotnetdud.blogspot.com&lt;/a&gt;)</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/vba/382436/382458/re-delete-entire-row-if-a-cell-contains-a-phrase/#382458</guid>
      <pubDate>Mon, 01 Dec 2008 23:29:50 -0700</pubDate>
      <category>VBA</category>
    </item>
    <item>
      <title>Re: Delete entire ROW if a cell contains a phrase</title>
      <link>http://www.programmersheaven.com/mb/vba/382436/429977/re-delete-entire-row-if-a-cell-contains-a-phrase/#429977</link>
      <description>Hello,&lt;br /&gt;
I tried this example in my own macro, but I (unsuccessfully) tried to convert to just clear the contents of the cell if certain (parts of) words appeared.  Can you tell me what I did wrong?&lt;br /&gt;
&lt;br /&gt;
Dim i1 As Long&lt;br /&gt;
    Dim iMax As Long&lt;br /&gt;
    Dim sText As String&lt;br /&gt;
    &lt;br /&gt;
    sText = "cipan" Or "ce Ty"&lt;br /&gt;
    sText = LCase(sText)&lt;br /&gt;
    iMax = Cells.SpecialCells(xlCellTypeLastCell).cell&lt;br /&gt;
    &lt;br /&gt;
    For i1 = iMax To 1 Step -1&lt;br /&gt;
        If InStr(1, LCase(Cells(i1, 3)), sText) &amp;lt;&amp;gt; 0 Then&lt;br /&gt;
            Cells(i1).ClearContents&lt;br /&gt;
        End If&lt;br /&gt;
    Next i1&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/vba/382436/429977/re-delete-entire-row-if-a-cell-contains-a-phrase/#429977</guid>
      <pubDate>Mon, 29 Oct 2012 06:41:47 -0700</pubDate>
      <category>VBA</category>
    </item>
    <item>
      <title>Re: Delete entire ROW if a cell contains a phrase</title>
      <link>http://www.programmersheaven.com/mb/vba/382436/429978/re-delete-entire-row-if-a-cell-contains-a-phrase/#429978</link>
      <description>Hello,&lt;br /&gt;
I tried this example in my own macro, but I (unsuccessfully) tried to convert to just clear the contents of the cell if certain (parts of) words appeared.  Can you tell me what I did wrong?&lt;br /&gt;
&lt;br /&gt;
Dim i1 As Long&lt;br /&gt;
    Dim iMax As Long&lt;br /&gt;
    Dim sText As String&lt;br /&gt;
    &lt;br /&gt;
    sText = "cipan" Or "ce Ty"&lt;br /&gt;
    sText = LCase(sText)&lt;br /&gt;
    iMax = Cells.SpecialCells(xlCellTypeLastCell).cell&lt;br /&gt;
    &lt;br /&gt;
    For i1 = iMax To 1 Step -1&lt;br /&gt;
        If InStr(1, LCase(Cells(i1, 3)), sText) &amp;lt;&amp;gt; 0 Then&lt;br /&gt;
            Cells(i1).ClearContents&lt;br /&gt;
        End If&lt;br /&gt;
    Next i1&lt;br /&gt;
&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/vba/382436/429978/re-delete-entire-row-if-a-cell-contains-a-phrase/#429978</guid>
      <pubDate>Mon, 29 Oct 2012 06:43:39 -0700</pubDate>
      <category>VBA</category>
    </item>
  </channel>
</rss>