Deleting a row
Hi Chuck,
I found the following code on Chip Pearson's page and modifed it slightly.
See if this works for you. It counts the number of entries in the B to AB
range and deletes the row if the count is 0.
------------------------
Option Explicit
Public Sub DeleteBlankRows()
Dim R As Long
Dim C As Range
Dim Rng As Range
On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
If Selection.Rows.Count 1 Then
Set Rng = Selection
Else
Set Rng = ActiveSheet.UsedRange.Rows
End If
For R = Rng.Rows.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Range("B" & R & ":AB" & R)) _
= 0 Then
Rng.Rows(R).EntireRow.Delete
End If
Next R
EndMacro:
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
--
Ken Hudson
"Chuck Neal" wrote:
Hope someone can help with some code. I've read the other examples and I'm
not sure if what I'm trying to do can be accomplished by the others.
A cell in column A has data in it (doesn't matter what the data is). If the
cells in Columns B thru AB are blank, I want to delete the row.
Chuck
|