Thread: Selecting items
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Selecting items

Once selected with CTRL + Click, the cells are selected.

Chip Pearson has code to allow de-selecting cells or ranges.

Sub UnSelectActiveCell()
Dim Rng As Range
Dim FullRange As Range
'Chip Pearson
If Selection.Cells.Count 1 Then
For Each Rng In Selection.Cells
If Rng.Address < ActiveCell.Address Then
If FullRange Is Nothing Then
Set FullRange = Rng
Else
Set FullRange = Application.Union(FullRange, Rng)
End If
End If
Next Rng

If FullRange.Cells.Count 0 Then
FullRange.Select
End If
End If

End Sub


Sub UnSelectActiveArea()
'Chip Pearson
Dim Rng As Range
Dim FullRange As Range
Dim Ndx As Integer
If Selection.Areas.Count 1 Then
For Each Rng In Selection.Areas
If Application.Intersect(ActiveCell, Rng) Is Nothing Then
If FullRange Is Nothing Then
Set FullRange = Rng
Else
Set FullRange = Application.Union(FullRange, Rng)
End If
End If
Next Rng
FullRange.Select
End If

End Sub


Gord Dibben MS Excel MVP



On Wed, 20 Jan 2010 16:15:01 -0800, Steven
wrote:

When you select items by holding down the Ctrl key and clicking a cell or
cells in order to get the sum of a group of items .... how do you unselect a
specific cell if you accidentally selected it in error?

Thank you,

Steven