Excel VBA check whether multiple cells selected

There might be several reasons why you want to check whether multiple cells have been selected by your user, but here’s one example of a survey where we ask the employee which office they are based in.

 

VBACheckMultipleCells1

 

You can use VBA to check whether the user has clicked a cell in the tick box range, and if so run the code to add the tick symbol and remove any other ticks in the range. However, your routine won’t know what to do if the user scrolls down to select multiple cells in the range at once.¬†Should it tick them all, just the top one, etc?

 

To workaround this, just add an additional IF statement around your routine which stops it if multiple cells are selected:

 

VBACheckMultipleCells2

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *