with the below code I m finding how many times a contact has been reached. In order to do so, the formula is using a named range (Weeks) and search for the partner name across multiple sheets.
I am not using a simple formula because the file change depending on the person that is using the file so I am using VBA.
Although the below code works, this is a very slow and I am wondering if someone could help me in speeding it up or could suggest me other methods to get the same results.
Sub ContactCycle()
Dim WsMaster As Worksheet
Dim WsLastRow As Long
Dim MyContactCycleRange As Range, cell As Range
Set WsMaster = ThisWorkbook.Worksheets("Master")
WsLastRow = WsMaster.Range("A" & Rows.Count).End(xlUp).Row
Set MyContactCycleRange = WsMaster.Range("AB5:AB" & WsLastRow)
Application.EnableEvents = False
For Each cell In MyContactCycleRange
cell.Formula = "=IF(SUMPRODUCT(COUNTIF(INDIRECT(""'""&Weeks&""'!""&""$A$6:$A$45""),$B5))>0,1,0)"
Next cell
Application.EnableEvents = True
End Sub
Thank you