LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need help with wayward ActiveCell.EntireRow.Delete

I have this code that I am running and there are a few issues that I can't
figure out, maybe someone out there can help. The code below is asking to
delete rows where the selected cell or the one next to it are blanks. My
problem is that when I run it, only 2 rows are delete even though there are 4
consecutive rows having the criteria of the "IF" condition met. The real fact
is that the code only delete every other row. Say for eaxmple I have this
four rows with in which the condition is true, only rows containing 2YK3342
and 2DA3328 are deleted. Leaving the rows with 2CN3434 and CT11058.
2YK3342
2CN3434
2DA3328
CT11058
For Each c In Range("C2:C" & dbelastRow).Cells
c.Select
If c.Value = "" Or c.Offset(0, 1).Value = "" Then
ActiveCell.EntireRow.Delete
End If
Next c

The other issue that I am having is the fact that in the following code
segment, the line: ActiveCell.EntireRow.Delete don't do anything even when
the if condition is true. It works fine in the code segment above, except it
skip every other row but it don't work in the code below at all.
Any ideas?
Thanks

For Each c In Range("A2:A" & dbelastRow).Cells
c.Select
If c.Value = marketName Then
strRow = Mid(c.Address(RowAbsolute:=False), 3)
For Each c1 In Range("A" & strRow & ":A" & dbelastRow).Cells
If c1.Value < marketName Then
endRow = Mid(c1.Address(RowAbsolute:=False), 3) - 1
Exit For
End If
Next c1
ElseIf c.Value < marketName Then
ActiveCell.EntireRow.Delete
'ActiveCell.Rows.Select
'Selection.Delete Shift:=xlUp
End If
Next c
 
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
Need Help with ActiveCell.EntireRow.Delete Ayo Excel Discussion (Misc queries) 4 July 20th 08 11:07 AM
Need Help with ActiveCell.EntireRow.Delete Ayo Excel Discussion (Misc queries) 8 July 19th 08 04:45 PM
If ActiveCell.Font.Bold = True Then ... trying to specify a range, not 'entirerow' Winawer Excel Programming 3 April 29th 06 11:08 PM
How to fix cell.entirerow.delete? guy Excel Programming 1 March 10th 05 02:31 AM
EntireRow.Delete Steph[_3_] Excel Programming 14 January 21st 05 10:31 PM


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