Handling Worksheet control events using a class module

Hi everyone.

When utilising controls from the Control Toolbox on worksheets, often one needs to use event code to handle the actions a user takes with them.

If however a large number of controls is used, this may become unwieldy because one has to add an event sub for each one of them. This article gives an example how one can use a class module with a single event subroutine for a set of (identical) controls.

Here’s a screenshot of the controls I’ve hooked up to a single event handler:

Posted in Uncategorized

2 thoughts on “Handling Worksheet control events using a class module

  1. It’s remarkable that we still lack the ability to create control arrays in VBA although we have it in MS VB 6.0 / VB.NET.

    Your solution overcome some of the issues but since not all events can be included we are forced to some extend to use VB-based COM add-ins instead.

    Kind regards,

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.