Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm starting to think that your cells in E through J are not really empty.
Do you have formulas returning blanks or spaces in these cells? Gord On Thu, 1 Apr 2010 15:55:02 -0700, ILoveMyCorgi wrote: I liked the formula but only yielded YY and no XX even though there were columns without data from E through J. I also tried the macro it did not work. I still had rows with data in columns A through D and no data in columns E through J are empty yet the rows have not been deleted. "Gord Dibben" wrote: You don't need a macro. In column 11 enter =IF(COUNTA(E1:J1)=0,"XX","YY") Copy down and autofilter for XX then delete the rows. Macro.............. Sub DeleteRows_If_E_to_J_MT() Dim lRow As Long Dim StartRow As Long Dim EndRow As Long With ActiveSheet StartRow = 1 EndRow = 1000 'adjust to suit For lRow = EndRow To StartRow Step -1 If Application.CountA(.Range(.Cells(lRow, "E"), _ .Cells(lRow, "J"))) = 0 Then .Rows(lRow).Delete Next End With End Sub Gord Dibben MS Excel MVP On Thu, 1 Apr 2010 11:13:02 -0700, ILoveMyCorgi wrote: I have an Excel spreadsheet with 10 columns. If columns 5 through 10 are empty, I want to delete the entire row and move on to the end of my spreadsheet. Is there a function or an easy Visual Basic macro I can run to accomplish this task? Thanks in advance for your help... I do not know what I'd do without this resource! . |