

Examples of such events would include changing the series of the chart or resizing the chart. A chart sheets purpose is to hold a chart. A chart sheet is different than a worksheet (which is where most of us are used to work in Excel). Chart Events: These are events related to the chart sheet.

Examples of these include initializing a UserForm or clicking a button in the UserForm. UserForm Level Events: These events would be triggered based on the actions in the ‘UserForm’.

Example of these would include closing any of the open workbooks or opening a new workbook.
#Excel vba open for input as code
Excel instantly opens a message box that shows the address of the cell.ĭouble-click is an event, and showing the message box is what I have specified in the code whenever the double-click event takes place. Similarly, you can create VBA codes for many such events (as we will see later in this article).īelow is a short visual that shows the double-click event in action. You can use the double-click event for this. Now, whenever anyone inserts a new worksheet, this code would automatically be executed and add the year prefix to the worksheet’s name.Īnother example could be that you want to change the color of the cell when someone double-clicks on it. So you only need to write the code and place it in the correct event subroutine (this is covered later in this article).įor example, if you insert a new worksheet and you want it to have a year prefix, you can write the code for it. This means that as soon as an event occurs, and if you have specified a code for that event, that code would instantly be executed.Įxcel automatically does this as soon as it notices that an event has taken place. There are many such events in VBA, and you can create codes for these events. When you double-click on a cell, it’s an event. When you insert a new worksheet, it’s an event. Let me first explain what is an event in VBA.Īn event is an action that can trigger the execution of the specified macro.įor example, when you open a new workbook, it’s an event.
