I have some simple VBA code in the Open trigger for a workbook that increments the open count so I can track how many times a workbook has been opened. However, it appears that it is being executed twice whenever the workbook is opened, as the count gets incremented by two each time the workbook is opened. For example, if I set the cell value at 2 then close the workbook, the cell value will be 4 the next time I open the workbook. Is there a workaround for this?
Private Sub Workbook_Open()
Dim dashboardSheet As Worksheet
Dim instructionsSheet As Worksheet
Dim numOpens As Long
' Get references to the sheets
Set dashboardSheet = ThisWorkbook.Sheets("Dashboard")
Set instructionsSheet = ThisWorkbook.Sheets("Instructions")
' Get the value from cell BG5
numOpens = dashboardSheet.Range("BG5").Value
' Increment the value in cell BG5
dashboardSheet.Range("BG5").Value = numOpens + 1
End Sub