Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I have a macro statement that, if a field in a certain column is blan it will look to another column in the same row, and if that fiel contains a certain name it will delete the entire row. I want statement that will NOT delete the row if it contains a certain name i.e. if any field in col E is blank look to col D and delete the entir row if it does not contain Mark, Brian and Karl. Can anyone please help me on this?? Thanks in advance, Cathal -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I _think_ that this does what you want:
Option Explicit Sub testme02() Dim iRow As Long Dim FirstRow As Long Dim LastRow As Long Dim wks As Worksheet Set wks = ActiveSheet With wks FirstRow = 1 LastRow = .Cells(.Rows.Count, "D").End(xlUp).Row For iRow = LastRow To FirstRow Step -1 If IsEmpty(.Cells(iRow, "e")) Then Select Case LCase(.Cells(iRow, "D").Value) Case Is = "mark", "brian", "karl" 'do nothing Case Else .Rows(iRow).Delete End Select End If Next iRow End With End Sub I did use column D to find the last row. "CPower <" wrote: Hi all, I have a macro statement that, if a field in a certain column is blank it will look to another column in the same row, and if that field contains a certain name it will delete the entire row. I want a statement that will NOT delete the row if it contains a certain name. i.e. if any field in col E is blank look to col D and delete the entire row if it does not contain Mark, Brian and Karl. Can anyone please help me on this?? Thanks in advance, Cathal. --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete row if blank in a column | Excel Worksheet Functions | |||
I cannot delete a blank column from an Excel spreadsheet. | Excel Discussion (Misc queries) | |||
How to delete column label from pivot table field | Excel Worksheet Functions | |||
blank data field shows quote in formula, how to delete it? | Excel Discussion (Misc queries) | |||
Delete Entire Row If Column C is Blank | Excel Programming |