Excel – How to unselect Excel Cell using Keyboard Shortcut

keyboard shortcutsmicrosoft excel

One can select multiple Excel cells (either contiguously or not) using the keyboard shortcut Ctrl+Click.

How do you deselect one or more of these previously-selected cells?

Best Answer

By using the SHIFT and/or the CTRL keys you can select non-contiguous ranges. However, if you select a cell or area by mistake, there is no built in way to remove that from the selection without losing the entire selection and having to start over. This page describes to VBA procedures, UnSelectActiveCell and UnSelectCurrentArea that will remove the Active Cell or the Area containing the Active Cell from the current selection. All other cells in the Selection will remain selected.

Your best bet would be to add these to your Personal Macro workbook so that they are available to all open workbooks in Excel.

This procedure will remove the Active Cell from the Selection.

Sub UnSelectActiveCell()
    Dim R As Range
    Dim RR As Range
    For Each R In Selection.Cells
        If StrComp(R.Address, ActiveCell.Address, vbBinaryCompare) <> 0 Then
            If RR Is Nothing Then
                Set RR = R
            Else
                Set RR = Application.Union(RR, R)
            End If
        End If
    Next R
    If Not RR Is Nothing Then
        RR.Select
    End If
End Sub

This procedure will remove the Area containing the Active Cell from the Selection.

Sub UnSelectCurrentArea()
    Dim Area As Range
    Dim RR As Range

    For Each Area In Selection.Areas
        If Application.Intersect(Area, ActiveCell) Is Nothing Then
            If RR Is Nothing Then
                Set RR = Area
            Else
                Set RR = Application.Union(RR, Area)
            End If
        End If
    Next Area
    If Not RR Is Nothing Then
        RR.Select
    End If
End Sub