N
nancy
I am using this macro below to delete blank rows. It
works well, but it takes about 3-5 min to clean up blank
cells of about 21777 cells. This includes cells with
data. I have tested all other macro on the net and so far
this is the fastest. I also, think that all of the macro
is going beyond the 21777 cells. And this should be the
last cell with data. There is a second part of this macro
that was given to me earlier, but this is not the
problem. When i ran them independently, the second macro
only cleans within the range. I will appreciate and
suggestion or code that is faster than this one. Thanks
in advance.
Sub delete()
Dim Lrow As Long
Dim CalcMode As Long
Dim rng As Range, i As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = .UsedRange.Rows.Count To 1 Step -1
If Application.CountA(.Rows(Lrow)) = 0
Then .Rows(Lrow).delete
'This will delete the row if the whole row is
empty (all columns)
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
On Error Resume Next
Set rng = Range("A1:g21770").Rows
For i = 1 To rng.Count
rng(i).Find("John", , , xlWhole).Cut rng(i).Cells(1)
Next
End Sub
works well, but it takes about 3-5 min to clean up blank
cells of about 21777 cells. This includes cells with
data. I have tested all other macro on the net and so far
this is the fastest. I also, think that all of the macro
is going beyond the 21777 cells. And this should be the
last cell with data. There is a second part of this macro
that was given to me earlier, but this is not the
problem. When i ran them independently, the second macro
only cleans within the range. I will appreciate and
suggestion or code that is faster than this one. Thanks
in advance.
Sub delete()
Dim Lrow As Long
Dim CalcMode As Long
Dim rng As Range, i As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = .UsedRange.Rows.Count To 1 Step -1
If Application.CountA(.Rows(Lrow)) = 0
Then .Rows(Lrow).delete
'This will delete the row if the whole row is
empty (all columns)
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
On Error Resume Next
Set rng = Range("A1:g21770").Rows
For i = 1 To rng.Count
rng(i).Find("John", , , xlWhole).Cut rng(i).Cells(1)
Next
End Sub