I am making my first VBA program and trying to run the following function. The function checks a specific named range for the first row which does not have a value greater t
When Excel opens an unkown workbook containing VBA-Code, it usually asks for macros to be enabled by the user (depending on the application settings).
If the user then enables the macros, all event-driven procedures will be started, such as auto_open
or others.
Custom VBA Functions however require for a full recalculation of the workbook. Otherwise the functions return-value still is #NAME
, as the calculation is only done directly after opening the workbook.
In order to work directly at the first time opening, one has to add the following line to the workbook_open
event
'
' Workbook open event
Private Sub Workbook_Open()
Application.CalculateFullRebuild
End Sub