What events can I use in Excel

Where can I find a list of events in Excel? I want to write macros in VBA based on them. I already know Worksheet_BeforeDoubleClick , but I more or less just discovered that I accidentally / remembered that it was used in Access.

Does anyone have a complete list or know where I can find one of the different events in Excel?

+7
excel-vba excel
source share
3 answers
+4
source share

Here is an overview of the model of an excel object that you can use to navigate to members of each model.

http://msdn.microsoft.com/en-us/library/wss56bz7(VS.80).aspx

You would use this to get to:

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.application_members.aspx

Scroll down for events.

+5
source share

Another way to find them is to open VBE (Alt + F11), click on the object class module (for example, ThisWorkbook or Sheet1) and use the drop-down boxes at the top of the code panel. If, for example, you select "ThisWorkbook" from the drop-down list on the left, the right-hand drop-down box will contain all the events available to you.

For objects that are not a workbook or worksheet (Application, QueryTable, etc.), create your own class module (Insert - Class Module) in your project and enter (for example)

 Public WithEvents qt As QueryTable 

Now "qt" appears in the left drop-down list, and all events for QueryTable appear in the right part. You will notice that Intellisense only shows a limited number of objects when you enable WithEvents. These are the only objects that exposed the events. So you cannot enter

 Public WithEvents rng As Range 

because the Range object does not expose any events. A bit more cumbersome than James's answer, but a good way to view events when you know an object and get a list of objects with open events.

+3
source share

All Articles