PandoraGirl
New Member
- Joined
- Nov 18, 2017
- Messages
- 7
I have a spreadsheet where I retrieve almost 200 lines of data from another program. I have created the following macro that will hide all rows where the value of the cells are 0. The macro works but I think it takes too long. Can you help me speed it up? I have done extensive research on various forums. I added the .EnableEvents, ActiveSheet.DisplayPageBreaks and .Calculations lines based off that research but it still is not any faster. I am running Excel 2013 on a Windows 7 machine.
Thank you in advance!
Thank you in advance!
Code:
Dim ActRow As Integer
Dim Hide As Long
With Application
.ScreenUpdating = False
.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
.Calculation = xlCalculationManual
End With
Range("B9:Y200").Select
For Each cell In Selection
ActRow = ActiveCell.Row
Hide = Application.WorksheetFunction.Sum(Range("B" & ActRow & ":Y" & ActRow))
If Hide = 0 Then
ActiveCell.EntireRow.Hidden = True
Else
End If
ActiveCell.Offset(1, 0).Activate
Next cell
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
Rows("184").EntireRow.Hidden = False
End Sub