Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Find and remove row

Hello Everyone,

I have a file that has 4 columns, one of which stores a number value.

When this column has a value of 0 I want to remove the entire row.

Can I do this with Find/Replace or how would I do this?

Regards,

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Find and remove row

Hi,

Right click your sheet tab, view code and paste this in and run it. It
currently works on Column A so change this to suit. You will also need to
change the 1 in the line marked ** to match the column you are working on. 2
represents Column B etc.

Sub delete_Me()
Lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
For x = Lastrow To 1 Step -1
If Cells(x, 1).Value = 0 Then '**
Rows(x).Delete
End If
Next
End Sub

Mike

"TheLearner" wrote:

Hello Everyone,

I have a file that has 4 columns, one of which stores a number value.

When this column has a value of 0 I want to remove the entire row.

Can I do this with Find/Replace or how would I do this?

Regards,

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Find and remove row

Recorded
Sub Macro7()
'
' Macro7 Macro
' Macro recorded 8/12/2008 by Donald B. Guillett
'

'
Range("A1:A15").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="0"
Range("A13:A14").Select
Selection.EntireRow.Delete
Selection.AutoFilter Field:=1
End Sub

Cleaned up
Sub delete0rows()
mc = "a"
lr = Cells(rows.Count, mc).End(xlUp).Row
Range("a1:a" & lr).AutoFilter Field:=1, Criteria1:="0"
Range("A13:A1" & lr).EntireRow.Delete
Range("a1:a" & lr).AutoFilter
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"TheLearner" wrote in message
...
Hello Everyone,

I have a file that has 4 columns, one of which stores a number value.

When this column has a value of 0 I want to remove the entire row.

Can I do this with Find/Replace or how would I do this?

Regards,


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Find and remove row

You could do it with EditFind.

Select the column and EditFind

What: 0

Find All

Now in the "Found" dialog box hold SHIFT key and scroll to bottom and select
last "found" cell.

EditDeleteEntire Row.


Gord Dibben MS Excel MVP

On Tue, 12 Aug 2008 03:58:01 -0700, TheLearner
wrote:

Hello Everyone,

I have a file that has 4 columns, one of which stores a number value.

When this column has a value of 0 I want to remove the entire row.

Can I do this with Find/Replace or how would I do this?

Regards,


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
Find and remove data from a column jlclyde Excel Discussion (Misc queries) 3 May 21st 08 09:35 AM
find replace excel remove single character AlaskaBoy Excel Discussion (Misc queries) 5 March 31st 08 03:16 PM
remove convert/extract the number from'12345.56; ie remove ' sign WAN Excel Worksheet Functions 2 January 10th 08 12:38 PM
Find in Column A and Remove from Column B Johnny B[_2_] Excel Discussion (Misc queries) 0 March 28th 07 02:45 AM
find and remove a string of a cell value with comma as delimiter yefei Excel Discussion (Misc queries) 3 February 28th 06 01:05 PM


All times are GMT +1. The time now is 03:02 AM.

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"