Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If field in column is blank, delete if....

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default If field in column is blank, delete if....

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
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 row if blank in a column Outlook, eh? Excel Worksheet Functions 5 December 8th 07 02:46 PM
I cannot delete a blank column from an Excel spreadsheet. Chris L 99 Excel Discussion (Misc queries) 3 October 12th 06 01:08 PM
How to delete column label from pivot table field Evy Lum Excel Worksheet Functions 0 July 27th 06 02:13 PM
blank data field shows quote in formula, how to delete it? wdanner Excel Discussion (Misc queries) 2 April 4th 05 08:44 PM
Delete Entire Row If Column C is Blank John Excel Programming 5 July 19th 04 10:23 PM


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