Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Deleting rows with a two criteria

I need to edit this code to delete rows if cells in column B are empty AND if
the corresponding cell in Column A is MC, Disc or Visa, is that possible?

Sub delRows()
Range("B:B").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Deleting rows with a two criteria

Sub ClearData()
Dim iRows As Long
Dim i As Long
Dim rng As Range

iRows = Cells(Rows.Count, "A").End(xlUp).Row
Columns(1).Insert
Rows(1).Insert
Range("A1").Value = "Temp"
Range("A3").Resize(iRows - 1).Formula =
"=AND(C2="""",OR(B2={""MC"",""Disc"",""Visa""} ))"
Range("A1").Resize(iRows + 1).AutoFilter field:=1, Criteria1:=True
Set rng = Range("A1").Resize(iRows + 1).SpecialCells(xlCellTypeVisible)
rng.EntireRow.Delete
Columns(1).Delete
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"JOUIOUI" wrote in message
...
I need to edit this code to delete rows if cells in column B are empty AND

if
the corresponding cell in Column A is MC, Disc or Visa, is that possible?

Sub delRows()
Range("B:B").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub




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
Deleting several rows with given criteria Rechie Excel Discussion (Misc queries) 7 October 20th 09 01:38 PM
Deleting rows by specified criteria for duplicates Tasha Excel Discussion (Misc queries) 4 September 9th 08 10:48 AM
Deleting Rows w/ Specific Criteria MCSHMCH Excel Discussion (Misc queries) 2 September 28th 07 01:05 PM
Help - Deleting Rows on Text Criteria rayd8[_2_] Excel Programming 7 August 22nd 05 05:07 AM
Deleting rows based on criteria John Walker[_2_] Excel Programming 2 December 12th 03 08:37 PM


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