Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 10-04-2012, 11:52 PM
macropod's Avatar
macropod macropod is online now delete row Windows 7 64bit delete row Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,465
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
For Z = lastRow to 2 Step -1
  If Cells(Z, 4) = "" Then Cells(Z, 4).EntireRow.Delete
Next Z
The problem with a forward-working For .. Next loop when you're deleting items is that, upon deletion, the next item moves into the deleted item's position and doesn't get tested on the next iteration, because it's no longer at its former location.

PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
delete row Delete Space mariadanmark Excel 2 05-17-2012 02:53 AM
delete row cannot delete these lines! userman Word 4 05-02-2012 12:34 AM
Delete option greyed out when trying to delete row 1 tpcervelo Excel 2 11-15-2011 06:48 AM
delete row Cannot delete folders klingenfelter Outlook 10 02-04-2011 01:35 PM
delete email message via blackberry and have it delete on my pop3 and my outlook Iamthestorm Outlook 2 10-28-2010 12:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft