I have a book called travels.xlsm.
In this book, 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 the UDF 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 uses my user-defined function - the substring Workbook_open() will not be executed.
When I close the book when the active sheet does not use this function in conditional formatting, save and open it again - it runs as expected. It's a bit strange.
I do not want to close the book on a specific sheet or call Workbook_BeforeClose() sub to activate this "safe" sheet before closing the book.
Anyone who has an idea for a solution? Is this a bug in excel?
source share