Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2013, 12:54 PM
dunndealpr dunndealpr is offline a function that deletes all rows with no value in a certain column? Windows 7 64bit a function that deletes all rows with no value in a certain column? Office 2007
Novice
a function that deletes all rows with no value in a certain column?
 
Join Date: Aug 2011
Posts: 8
dunndealpr is on a distinguished road
Default a function that deletes all rows with no value in a certain column?

Hey all, I use Excel 2007. Can it be set up to delete all rows in an excel file when there is no value in a certain column? For instance, every row with no value in column H would automatically be deleted?
Reply With Quote
  #2  
Old 06-07-2013, 10:38 AM
BobBridges's Avatar
BobBridges BobBridges is offline a function that deletes all rows with no value in a certain column? Windows 7 64bit a function that deletes all rows with no value in a certain column? Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

There are ways to do that, but not with a worksheet function. I mention that because you used the word "function" in the subject line, and Excel worksheet functions only display data, never take any other action.

Still, there are things you can do. One obvious possibility is to sort on that column; all the rows without a value in that column will be sorted to the same place, and you can delete them all in a block.

If you don't like that option—for example if the sorting is important to you and you don't think you can put it back in the original order afterward—then you can write a VBA program, a "macro". I use VBA a lot, so it doesn't sound too hard for me, and if it's the sort of thing you're going to want to do more than just this once it's probably worth doing. But most people don't care to go to that effort, and if it's just the one time then maybe sorting it is the best idea. But if you want to try the macro option and have never done one before, let us know and someone (probably I) will coach you through it a little at a time.
Reply With Quote
  #3  
Old 06-08-2013, 06:50 AM
dunndealpr dunndealpr is offline a function that deletes all rows with no value in a certain column? Windows 7 64bit a function that deletes all rows with no value in a certain column? Office 2007
Novice
a function that deletes all rows with no value in a certain column?
 
Join Date: Aug 2011
Posts: 8
dunndealpr is on a distinguished road
Default

Hey Bob. Someone shot me this VBA script. Works beautiful.

Sub DeleteBlankRows()
Dim r As Long
For r = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(r, 5) = "" Then Rows(r).Delete
Next r
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
a function that deletes all rows with no value in a certain column? How to send several rows of data from one column to each recipient in one go mikustykus Mail Merge 14 09-30-2013 08:32 AM
a function that deletes all rows with no value in a certain column? Count rows and add blank rows accordingly Hoochtheseal Word VBA 1 01-29-2013 09:23 PM
a function that deletes all rows with no value in a certain column? Watermark deletes headers ChrisDevrell Word 1 05-01-2012 07:23 AM
a function that deletes all rows with no value in a certain column? merging rows and creating sub-rows gib65 Excel 2 12-09-2011 02:09 PM
a function that deletes all rows with no value in a certain column? Outlook deletes emails dbienenf Office 1 02-06-2011 03:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:15 PM.


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