Workbook and Worksheet Events
- 02:12
How worksheet and workbook events can be used to execute Excel VBA procedures.
Downloads
No associated resources to download.
Transcript
Events are actions performed by users in Excel, such as opening a workbook or double clicking Excel.
Some objects in Excel VBA recognize specific events and VBA code can be written so that it runs when a specific event occurs.
Events can be classified as workbook events, events that occur for a particular workbook, such as open or save worksheet. Events. Events that occur for a particular worksheet, such as before, double click or calculate chart events.
Events that occur for a particular chart.
Application, events.
Events that occur for the application ie; Excel, user form events.
Events that occur for a particular user form or object contained on the user form and events that are aren't associated with objects such as the on time and on-key event, we're going to explore worksheet events and workbook events.
Workbook events are connected to the Excel workbook in the VBA window.
Double click this workbook in the VBA Project Explorer Select workbook from the object dropdown menu on the top left hand corner of the VBE window and select the event from the procedure dropdown on the top right hand corner of the VBE window.
To access worksheet events in the Visual Basic Explorer, double click the specific sheet in the Project Explorer window Select worksheet from the object dropdown menu on the top left hand corner of the Visual Basic Editor window and select the event from the procedure dropdown menu on the top right hand side of the Visual Basic Editor window.