# Microsoft Office Application Help - Excel Help forum > Excel General >  >  Invert Selection of Cells

## jman0707

I'm trying to highlight a bunch of cells in clusters not close together, and then invert the selection so that all cells BUT these are selected (therefore capturing all possible cells that someone could scroll to).  In XL03 you could go to File > Invert Selection and it would work fine.  But in XL07 which I have now, there doesn't seem to be a way to do it.  Also, when using ctrl^a to highlight everything, and while still holding control in XL03 you could de-select specific cells, not so much in 07.  I need to know if there's a way to do it with no macros involved.  If not, I need a macro to do such a function on any given worksheet.  Thanks!

----------


## shg

I've never heard of a standard feature to invert selection in Excel 2003 or any other version. It's easy enough (but not particularly efficient) to do in VBA, given some particulars.

Invert the selection with respect to what -- all the cells on the worksheet, the used range, the bounding box of the current selection, or ...?

----------


## jman0707

I would want to invert with respect to all the cells on the worksheet (seen and unseen).  At least that's what my application needs now.  But I can see use of inverting it with respect to the bounding box of the current cells (only the ones seen).  Maybe you could help me with both?  I know nothing about VBA, so detailed instructions would be very much appreciated!  And I'd like to create buttons to execute the macro if possible.  Thanks!

----------


## shg

Here are some range set algebra functions you can play with.



```
Please Login or Register  to view this content.
```


Select some odd collection of cells, and from the VBE Immediate window, try



```
Please Login or Register  to view this content.
```

----------


## jman0707

Awesome thanks!

----------


## shg

Stop back and pick up a fresh copy -- there was an error in the RangeBox function.

----------


## jman0707

Awesome, did you just edit your post above?  I'll grab it.

----------

