LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete if blank...

Hi all,

I am trying to delete an entire row if a cell in col F is blank and i
the corresponding cell in col E does NOT equal a certain list of names
Here are two different pieces of code that i have been trying to use bu
they don't seem to work. The second piece of code worked in anothe
worksheet using different cols.

If col F has a blank cell, this piece of code deletes the entire row n
matter what name is in col E:

Dim i, j As Long
j = Range("E65536").End(xlUp).Row
For i = j To 1 Step -1
If Range("E" & i).Value < "Bertrandk" _
Or Range("E" & i).Value < "christianp" _
Or Range("E" & i).Value < "dennisk" _
Or Range("E" & i).Value < "josephl" _
Or Range("E" & i).Value < "mariaf" _
Or Range("E" & i).Value < "vincentp" Then
If Range("F" & i).Value = "" Then
Rows(i).EntireRow.Delete
End If
End If
Next i



This piece of code does not delete or keep any row if it has a blan
cell in col F:

Dim c As Range

For Each c In Range("F:F").SpecialCells(xlCellTypeBlanks)
If c.Offset(0, -1) = "Bertrandk" _
Or c.Offset(0, -1) = "christianp" _
Or c.Offset(0, -1) = "dennisk" _
Or c.Offset(0, -1) = "josephl" _
Or c.Offset(0, -1) = "mariaf" _
Or c.Offset(0, -1) = "vincentp" Then
'do nothing
Else
c.Offset(0, 45).Value = 1
End If
Next c

On Error Resume Next 'ignore error
Selection.Offset(0
45).SpecialCells(xlCellTypeConstants).EntireRow.De lete


Could someone please enlighten me as to what i am doin wrong in eithe
of these pieces of code??

Thanks,
Cathal

--
Message posted from http://www.ExcelForum.com

 
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 Blank Lines Templar Excel Discussion (Misc queries) 2 December 27th 08 05:08 PM
Delete blank rows JakeShipley2008 Excel Discussion (Misc queries) 2 October 30th 08 02:18 AM
Delete a row if blank cell mohd21uk via OfficeKB.com New Users to Excel 2 April 13th 06 04:39 PM
delete blank rows Pam C Excel Discussion (Misc queries) 1 January 17th 06 07:13 PM
"BLANK" - need to delete anjgoss Excel Worksheet Functions 3 August 25th 05 05:31 PM


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