A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Without testing, it is difficult to say what the problem might be. Really need to see the code for following:
- Workbook_Open event
- UDF code
- Some values that the UDF uses.
If the UDF relies on data that only becomes valid after Workbook_Open and the UDF is attempting to run before the open event is finished then it could cause it. Inserting a MsgBox "Open event" as the last line of code in the open event and as the first line of code in the UDF insert a MsgBox "UDF" and see which MsgBox displays first.
You could try inserting Application.Calculate as the last line of code in the Open Event to force a re-calculation after the other processing.
Could also try Application.Volatile as the first line of the UDF because then if the open event changes something that the UDF relies on then it should recalculate with the new data.
If instead of pressing F2, what occurs if you just press F9 to force a re-calculation. Also, ensure that you do not have calculation set to manual.