Excel VBA "Unselect" wanted

I would like the final appearance after my VBA has finished running to be empty of selection -- to have no cell or range on any sheet colored (if it was range selected) or in a bold line box (anything that was selected). Pupose: to present the client with a neat final appearance.

I've searched and cannot find how to do this. There is an Unselect according to MS, but it doesn't seem to do anything.


Select any cell and turn off CutCopy:

  Range("A1").Select
  Application.CutCopyMode = False

Excel always has something selected. A work around is needed. Selecting a cell off screen will set focus there, so that won't work in and of itself. This code places the cursor off screen and then scrolls the sheet back up to view A1.

Sub NoSelect()    
  Range("BB100").Select
  ActiveWindow.SmallScroll up:=100
  ActiveWindow.SmallScroll ToLeft:=44
End Sub

If you are really wanting 'nothing selected`, you can use VBA to protect the sheet at the end of your code execution, which will cause nothing to be selected. You can either add this to a macro or put it into your VBA directly.

Sub NoSelect()
   With ActiveSheet
   .EnableSelection = xlNoSelection
   .Protect
   End With
End Sub

As soon as the sheet is unprotected, the cursor will activate a cell.


There is a tricky way to do it.

Create an object such as a button. Select this button, then hide it, and no cell will be selected.

ActiveSheet.Shapes("Button 1").Visible = True

ActiveSheet.Shapes("Button 1").Select

ActiveSheet.Shapes("Button 1").Visible = False

That's it.