'How to make Sub AddSum() run automatically when the excel starts
I have a code under Addsum(), which needs to be automatically run when the excel starts.
I have tried several ways like
Sub Auto_open
Sub Addsum()
...code
End Sub
End Sub
another method like calling other subs option,
Sub RunAll()
Call Auto_Open
Call AddSum
End Sub
but none seems to satisfy the requirement as running the Addsum() immediately when the workbook opens.
Please guide me!
Solution 1:[1]
As @TimWilliams has shown, first place your AddSum procedure in a regular module (Insert >> Module) . . .
Sub AddSum()
...code
End Sub
Then call your procedure from your Auto_open event handler in the code module for ThisWorkbook . . .
Sub Auto_open()
AddSum
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Domenic |
