Help with Visual Basic for Excel
Hi Kelly,
Try:
'================
Public Sub Tester()
Dim rng As Range
Dim rCell As Range
Dim delRng As Range
Dim WB As Workbook
Dim SH As Worksheet
Dim CalcMode As Long
Set WB = ActiveWorkbook '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE
Set rng = Intersect(SH.UsedRange, SH.Columns("P:P"))
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
For Each rCell In rng.Cells
If Not IsEmpty(rCell) Then
If delRng Is Nothing Then
Set delRng = rCell
Else
Set delRng = Union(rCell, delRng)
End If
End If
Next rCell
If Not delRng Is Nothing Then
delRng.EntireRow.Delete
End If
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<================
---
Regards,
Norman
"KellyInCali" wrote in message
...
I need help with code to delete all rows for which column P is not empty.
Thanks in advance.. Kelli
|