LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 158
Default Delete an entire row if two cells......

You can try this code:

Sub RemoveN()
' Macro recorded 4/30/2008 by Steven Bitaxi
'

Set Rng = Range("A1").CurrentRegion

' Assuming you have a header row
Set Rng = Rng.Rows(2).Resize(Rng.Rows.Count - 1)

Set Rng = Rng.SpecialCells(xlVisible)

' Removes rows with "N" in Field 2 (column B)
Selection.AutoFilter Field:=2, Criteria1:="=*N*"
Rng.Select
Selection.EntireRow.Delete
' Removes filter
Selection.AutoFilter Field:=2

' Removes rows with "N" in Field 3 (column C)
Selection.AutoFilter Field:=3, Criteria1:="=*N*"
Rng.Select
Selection.EntireRow.Delete
' Removes filter
Selection.AutoFilter Field:=3
End Sub


On Apr 30, 12:18*pm, Red2003XLT
wrote:
Is there an automated way? *I'm sure my users want to click and print.

Copy and paste the extract (rawdata-worksheet) then click and print



"ShaneDevenshire" wrote:
Hi,


You could put an auto filter on columns B & C and filter both for "N". *The
results would be only the rows containing N in both B & C. *Then highlight
the row numbers and press Ctrl - (Ctrl + Minus).


--
Thanks,
Shane Devenshire
Microsoft Excel MVP


"Red2003XLT" wrote:


Hello All,


How do I delete (for an entire worksheet) rows that contain "N"?


The cells are "B and "C". *


If "B" and "C" contain the letter "N" delete the entire row?
The letter "N" is the only thing in the cell.- Hide quoted text -


- Show quoted text -


 
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 entire row if David T Excel Discussion (Misc queries) 2 December 6th 06 10:14 PM
How do I delete non-printing characters from an entire worksheet? Laurie Excel Discussion (Misc queries) 1 October 4th 06 10:14 PM
CANNOT DELETE AN ENTIRE COLUMN ibeetb Excel Discussion (Misc queries) 4 June 23rd 06 02:55 AM
Can I delete an entire row if condition is not met? Christine Excel Worksheet Functions 8 May 4th 06 09:47 AM
Easiest way to delete blank cells in column (not entire row) sramsey Excel Discussion (Misc queries) 4 February 16th 06 04:28 PM


All times are GMT +1. The time now is 07:17 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"