Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default how can I delete rows based on column value

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default how can I delete rows based on column value

apply an autofilter to column C, filter on 0, and then just delete the
visible rows.

--
__________________________________
HTH

Bob

"mike" wrote in message
...
How can I delete certain rows of my worksheet that has a specific value in
a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default how can I delete rows based on column value

The following works for one "0". You can build a loop around this and use
FindNext() to locate others.

Option Explicit
Sub find()

Dim c As Range
Set c = Range("C:C").find(What:="0")
Rows(c.Row).Delete

End Sub


"mike" wrote:

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default how can I delete rows based on column value

PS. I like bob's idea better (just refreshed the page) :)

"mike" wrote:

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default how can I delete rows based on column value

That still deleted everything.



"StumpedAgain" wrote:

PS. I like bob's idea better (just refreshed the page) :)

"mike" wrote:

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default how can I delete rows based on column value

I gues I could just sort and delete, that's even simpler. I don't really need
to preserve thorder.

"StumpedAgain" wrote:

PS. I like bob's idea better (just refreshed the page) :)

"mike" wrote:

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default how can I delete rows based on column value

This shoudl do the trick.

Sub DeleteRows()

Dim i As Long
Dim LastRow As Long

LastRow = Sheets("Sheet1").Cells(Rows.Count, "C").End(xlUp).Row

For i = LastRow To 1 Step -1
If Range("C" & i) = 0 Then
Range("C" & i).EntireRow.Delete
End If
Next i

End Sub

--
Cheers,
Ryan


"mike" wrote:

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default how can I delete rows based on column value

Sub DeleteRows_With_Zero()
FindString = "0"
Set b = Range("C:C").Find(what:=FindString, lookat:=xlWhole)
While Not (b Is Nothing)
b.entirerow.Delete
Set b = Range("C:C").Find(what:=FindString, lookat:=xlWhole)
Wend
End Sub


Gord Dibben MS Excel MVP

On Tue, 24 Jun 2008 13:44:00 -0700, mike wrote:

How can I delete certain rows of my worksheet that has a specific value in a
specific column. For example, delete all rows that have a value of '0' in
column 'C'??

Mike


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Rows based on value Sabosis Excel Worksheet Functions 4 October 28th 08 11:21 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Code help, delete rows based on column criteria Stout Excel Discussion (Misc queries) 2 March 20th 07 01:17 PM
Delete rows based on value... Gordon[_2_] Excel Programming 3 September 15th 06 09:14 PM
Delete Rows based on criteria in Column A (not working) Mslady[_7_] Excel Programming 2 October 29th 05 01:27 AM


All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"