View Single Post
  #2   Report Post  
Paul B
 
Posts: n/a
Default

Octavio, here is a post by Chip Pearson on the subject,

I long ago got tired of the situation you describe, and wrote two
procedures to deal with it. The first, UnSelectActiveCell removes
the active cell from the selection. The second, UnSelectActiveArea,
removes an entire area from the selection. Attach these procedures
to your right-click menu and you'll be all set.


Sub UnSelectActiveCell()
Dim Rng As Range
Dim FullRange As Range


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()


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(ActiveCe*ll, 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
'-----------------------------*--


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Octavio" wrote in message
...
Once you select a group of cells, how do you deselect from that previously
selected group one cell or a few unwanted cells without deselecting the

rest
of the group?