Can anyone give me some hints to improve the speed of this code?
Sub buildbusinesswriterstats()
Dim businesswriters(999, 2)
Dim Counted As Boolean
Application.ScreenUpdating = False
Sheets("Data").Activate
For Each cell In Range("E2:E999")
Counted = False
For i = 0 To Counter
If cell.Value = businesswriters(i, 0) Then
businesswriters(i, 1) = cell.Offset(0, -4).Value
businesswriters(i, 2) = businesswriters(i, 2) + 1
Counted = True
Exit For
End If
Next
If Counted = False Then
businesswriters(Counter, 0) = cell.Value
businesswriters(Counter, 1) = cell.Offset(0, -4).Value
businesswriters(Counter, 2) = businesswriters(Counter, 2) + 1
Counter = Counter + 1
End If
Sheets("Business Writers").Activate
Range("A1").Activate
Cells.ClearContents
Range("A1").Value = "Business Writer"
Range("B1").Value = "Last Lodged"
Range("C1").Value = "No. Lodged"
Range("D1").Value = "State"
Range("E1").Value = "Branch"
Range("A1:E1").Font.Bold = True
Range("A2").Activate
For MyRow = 0 To Counter
For MyColumn = 0 To 2
ActiveCell.Offset(MyRow, MyColumn).Value = businesswriters(MyRow, MyColumn)
Next
ActiveCell.Offset(MyRow, 3).Formula = "=VLOOKUP(A" & MyRow + 2 & ",'Business Writer List'!A:D,3,FALSE)"
ActiveCell.Offset(MyRow, 4).Formula = "=VLOOKUP(A" & MyRow + 2 & ",'Business Writer List'!A:D,4,FALSE)"
Next
Next
Application.ScreenUpdating = True
End Sub