Hi,
I have about 5000 rows where the column "AY - AY1:AY5008" will have value of True or False, so I want to hide all rows that have value "FALSE"
I have a code that does this, but it is working very very slow
Is there anyway to speed this up or perhaps it will work slow because of the number of rows I have
I am pasting below the code that I am using
Please help
I have about 5000 rows where the column "AY - AY1:AY5008" will have value of True or False, so I want to hide all rows that have value "FALSE"
I have a code that does this, but it is working very very slow
Is there anyway to speed this up or perhaps it will work slow because of the number of rows I have
I am pasting below the code that I am using
Please help
Code:
Sub Hide()
Dim Lastrow As String
Dim Rng As Range, cell As Range
Application.ScreenUpdating = False
On Error Resume Next
With ThisWorkbook.Worksheets("ProjectScheduleDetails")
.Rows.Hidden = False
.Cells(.Rows.Count, 1).Select
If ActiveCell.Value = "" Then
Lastrow = Selection.End(xlUp).Row
Else
Lastrow = Rows.Count
End If
'Set Rng = Range("AY1:AY" & Lastrow) 'choose column where value exists
Set Rng = Range("AY1:AY5008") 'choose column where value exists
For Each cell In Rng
If cell.Value = "FALSE" Then 'Change the value based on which the rows need to be hidden
cell.EntireRow.Hidden = True
End If
Next cell
End With
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: