I have a workbook named travels.xlsm.
In ThisWorkbook I have this code:
Private Sub Workbook_Open()
MsgBox "hello"
Application.Calculation = xlManual
ActiveWorkbook.RefreshAll 'refresh the querytables without recalculating
Application.Calculation = xlAutomatic
End Sub
and this code in UDFs module:
Function hasHyperlink(rng As Range) As Boolean
hasHyperlink = rng.Hyperlinks.Count
End Function
when I open the file when the active sheet contains conditional formatting that is using my user-defined function - the Workbook_open()
sub won't execute.
When I close the workbook when the active sheet does not use this function in conditional formatting, save and open again - it executes as expected. This is a bit strange.
I don't want to close the workbook on a specific sheet or invoke the Workbook_BeforeClose()
sub to activate that "safe" sheet before closing the workbook..
Anyone with an idea for solution? Is that a bug in excel?