Article ID: 832293 - View products that this article applies to.
When you create a Microsoft Visual Basic for Applications (VBA) macro that selects multiple non-contiguous ranges in a Microsoft Excel workbook that uses a VBA expression that is similar to the following, actions that were only supposed to occur with non-contiguous cells occur to every cell in the original selection on the worksheet:
can be any one of the following:
This behavior occurs if you select more than 8,192 non-contiguous cells with your macro. Excel only supports a maximum of 8,192 non-contiguous cells through VBA macros.
Typically, if you try to manually select more than 8,192 non-contiguous cells, you receive the following error message:
However, when you use a VBA macro to make the same or a similar selection, no error message is raised and no error code is generated that can be captured through an error handler.
The selection is too large.
To work around this behavior, you may want to create a looping structure in your VBA macro that handles less than the maximum 8,192 cells.
Article ID: 832293 - Last Review: November 10, 2006 - Revision: 2.2
Contact us for more help
Connect with Answer Desk for expert help.