Browse » Home
Friday, September 16, 2011
How to Deselect a Cell
1. Launch Microsoft Excel.
2. Hold down the 'Alt' key and press 'F11.' This will open the Visual Basic editor.
3. Click 'Insert' and click 'Add new module.' Paste the following code in the module on the right and press 'Enter:'Sub UnSelectActiveCell()Dim Rng As RangeDim FullRange As RangeIf Selection.Cells.Count > 1 ThenFor Each Rng In Selection.CellsIf Rng.Address
ActiveCell.Address ThenIf FullRange Is Nothing ThenSet FullRange = RngElseSet FullRange = Application.Union(FullRange, Rng)End IfEnd IfNext RngIf FullRange.Cells.Count > 0 ThenFullRange.SelectEnd IfEnd IfEnd Sub
4. Exit the Visual Basic Editor to get back to Excel.
5. Click 'Tools' >> 'Macro' >> 'Macros' and then double-click 'UnSelectActiveCell.'
6. Hold down the 'Ctrl' key and select the cells that you wish to deselect.
7. Repeat Step 5.