Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
Why don't you select cell A1 when you save to present a clean look. If you want to strip cell formatting that is a different thing. –  wbeard52 Sep 4 '12 at 0:09
    
The cursor has to be somewhere. Why not place it bottom right with Worksheets("xxxx").Cells(Rows.Count,Columns.Count).Select or anywhere that is at least a screen away from the used area. –  Tony Dallimore Sep 4 '12 at 8:16
    
could you just place it back where it was when the macro was called? –  Sean Cheshire Sep 4 '12 at 15:45

3 Answers 3

The only answer is to cheat.

Hide column A and row 1

Put cursor in A1. There will be a tiny dot in the corner of B2

share|improve this answer
    
or you could select a cell outside of the viewable range. –  KronoS Sep 5 '12 at 18:21
    
@KronoS, which at 10% zoom, and a 1280x1024 screen is ~HA375. perhaps XFD1048576 ? :) –  Sean Cheshire Sep 5 '12 at 18:25

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.

share|improve this answer

Select any cell and turn off CutCopy:

  Range("A1").Select
  Application.CutCopyMode = False
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.