Question : Select inverse or using Control to select and DE-select multiple cells.

Have an odd situaiton...

Friend of mine is fixing a spreadsheet where conditional formating has been lost (for whatever reason) on several cells not adjacent to one another.  She can of course use edit GO TO - Special - conditional formating to select the cells that ARE conditionally formated.

Is there a way she can select the inverse from this?

Any help would be met with many thanks.

Answer : Select inverse or using Control to select and DE-select multiple cells.

Hi IUfoltzie,

Hopefully someone else can come up with something better than what I'm about to propose.

Sub LeaveMeRed()
    ActiveSheet.UsedRange.Select
    Selection.Font.ColorIndex = 3 'turns all cells red
    Selection.SpecialCells(xlCellTypeAllFormatConditions).Select
    Selection.Font.ColorIndex = 1 'turn the cells with condition formatting back to black
End Sub

This will color all cells in the active sheet red, then select the cells with Conditional Formatting, changing them to black. The choice's of colors are arbitrary. In fact even the color is arbitrary; she could use Underline or Strikeout formats, for example. Doesn't matter.

Also, UsedRange could be replaced with CurrentRegion if the data she's working on is bounded by blank cells. Or simply select the cells first, and comment out the first code line before running the macro. A little less draconian.

This, of course does not select the cells, but will make them easier to locate, either visually or by using the Find->Options->Format then choosing the format she's looking for in the cells without Conditional Formatting. It will select them one-at-a-time using Find Next.

Maybe someone has a better idea so that those cells can also be selected. (I was thinking of the Areas collection, but that appears to be readonly.)

Hope this is of some help anyway.

Regards,
Justin
Random Solutions  
 
programming4us programming4us