PC Review


Reply
Thread Tools Rate Thread

delete row on based on cell value

 
 
=?Utf-8?B?R0tXIGluIEdB?=
Guest
Posts: n/a
 
      18th Sep 2007
If a cell contains a certain value, I want to delete the row it is in, e.g.,
if cell K2 has value 0 then delete row 2
 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      18th Sep 2007
Public Sub ProcessData()
Const TEST_COLUMN As String = "K" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow to 1 Step -1
If .cells(i, TEST_COLUMN).Value = 0 Then
.Rows(i).Delete
End If
Next i
End With

End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"GKW in GA" <(E-Mail Removed)> wrote in message
news:164013D2-A179-4C33-A2EF-(E-Mail Removed)...
> If a cell contains a certain value, I want to delete the row it is in,
> e.g.,
> if cell K2 has value 0 then delete row 2



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete row based on cell value stantune Microsoft Excel Misc 1 2nd Feb 2008 06:43 PM
Is there a way to delete a cell value based on a condition? =?Utf-8?B?UGVhbnV0?= Microsoft Excel Misc 2 2nd Oct 2006 09:55 PM
delete row based on value of cell in row AD108 Microsoft Excel Programming 4 30th Jul 2006 03:55 AM
Delete Row based off cell content =?Utf-8?B?Q2h1Y2sgTmVhbA==?= Microsoft Excel Misc 3 29th Mar 2006 08:52 PM
Delete rows based on Cell name gmunro Microsoft Excel Programming 1 25th Nov 2005 01:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:06 PM.