View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Can someone help me?

I think you are right, Gord. The code I suggested worked just fine when
tested. The OP has to have some cells with "invisible" data in them for the
code not to work. Or, probably formulas with a "" value.



"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
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!

.