I have the following user-defined function, which works independently (that is, it does what it is supposed to):
Function ActivityIndex(currentDate As Date, projectName As String _
, firstRow As Integer, lastRow As Integer)
Dim dateColumn As Integer
dateColumn = (currentDate + 1) / 7 - 5575
Dim count As Integer
count = 0
Dim i As Integer
i = firstRow
Do While i <= lastRow
If i >= 63 And i <= 69 Then
i = i + 1
ElseIf Worksheets(projectName).Cells(i, dateColumn) = _
Worksheets(projectName).Cells(i, dateColumn - 1) Then
i = i + 1
Else
count = count + 1
i = i + 1
End If
Loop
ActivityIndex = count / (lastRow - firstRow + 1 - (70 - 63))
End Function
However, since I have added it to my worksheet, my Worksheet_Change sub no longer works:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 3 Then
Call UpdateLink("E1", "Project View")
Call GetDates
Call ResetDate("Project View", "Weighting", 56, 5)
Call ResizeFont
End If
End Sub
Every part of the Worksheet_Change worked before I started calling my function ACTIVITYINDEX from cells on the worksheet.
Is it possible that, because it is called from a cell, ACTIVITYINDEX is also being called with every Worksheet_Change trigger and somehow out-competing my Worksheet_Change sub