I have done a Macro code where I was able to show rows which contains the word "Overdue" and hide the other rows which contain the word (Completed, Pending, in progress, Delayed". everything was going smoothly but it takes like 2 minutes for the macro to work and the database still empty. I have read that arrays can fix this problem and make the macro work really fast. I have tried to convert my code to array but I was unsuccessful.
Just for your information the first row for me is (18) and the column is (Q) so Q18 which have the first data.
Sub Overdue()
On Error Resume Next
Application.ScreenUpdating = False
Worksheets("Dashboard-Data").Rows.EntireRow.Hidden = False
ltrw = Cells(Rows.Count, "Q").End(xlUp).Row
For i = 2 To ltrw
If Cells(i, 17).Value = "Overdue" Then
Cells(i, 1).EntireRow.Hidden = False
ElseIf Cells(i, 17).Value = "Pending" Then
Cells(i, 1).EntireRow.Hidden = True
ElseIf Cells(i, 17).Value = "In Progress" Then
Cells(i, 1).EntireRow.Hidden = True
ElseIf Cells(i, 17).Value = "Completed" Then
Cells(i, 1).EntireRow.Hidden = True
ElseIf Cells(i, 17).Value = "Delayed" Then
Cells(i, 1).EntireRow.Hidden = True
ElseIf Cells(i, 17).Value = "Delayed & Overdue" Then
Cells(i, 1).EntireRow.Hidden = True
Else
Cells.EntireRow.Hidden = False
End If
Next i
Application.ScreenUpdating = True
End Sub