View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Can someone help me?

Did you read any of the other replies you got?

Do you have just the three sheets or more but only need deleting on Sheets 1
through 3?

I will assume three only and column A will be used to determine end of data
for each sheet.

Sub DeleteRows_If_E_to_J_MT()
Dim lRow As Long
Dim StartRow As Long
Dim EndRow As Long
Dim ws As Worksheet
EndRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Row
For Each ws In ActiveWorkbook.Worksheets
With ws
StartRow = 1
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
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 1 Apr 2010 15:17:07 -0700, ILoveMyCorgi
wrote:

I am sorry. What I am trying to do is analyze each row and if columns E
through I are empty, delete that particular row, go on to the next row and
analyze, etc. all the way to the end of my populated rows. One thing I also
forgot to mention is that I have three worksheets, Sheet1, Sheet2, Sheet3
with data where I need to delete the rows without data in the last five
columns. I hope I make sense. thanks for your time.

"Rick Rothstein" wrote:

I am confused at what you ultimately want done here given the wording of
your message; specifically, this part... "I want to delete the entire row
and move on to the end of my spreadsheet." Does that mean you are only
examining one row and if the condition is met for that one row, delete it
and go to the end of your data? If so, which row are we talking about... the
row with the active cell or some fixed row which you neglected to tell us?
And where at the end of your date... which column?

--
Rick (MVP - Excel)



"ILoveMyCorgi" wrote in message
...
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!


.