VBA – Select Multiple Cells in a Excel Range

Selecting multiple cells in Excel through VBA may be quite a difficult task. Although, using Select is not always a good practice, sometimes it should be done.

To generate some numeric values, let’s run the following:

After this, we have the excel file from above filled with some “random” numbers. Now the “Select Multiple” trick:

myUnion() is used to build up the range of the cells. Thus, it is quite ok that once it is selected, all the cells with the highest value are selected.

Cheers! 🙂

Tagged with: , ,