me here is the full address,
http://groups.google.com/group/micr...130f42fe0e9/8f3070ba01635091#8f3070ba01635091
here is the code that Chip posted
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(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
'-------------------------------
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com [email protected]
And to add it to you right click menu
Put the following in the Workbook_Open
procedure of your personal.xls file.
With Application.CommandBars("Cell").Controls
With .Add(temporary:=True)
.Caption = "Unselect Active Cell"
.OnAction = ThisWorkbook.Name & "!UnSelectActiveCell"
.BeginGroup = True
End With
With .Add(temporary:=True)
.Caption = "Unselect Active Area"
.OnAction = ThisWorkbook.Name & "!UnSelectActiveArea"
End With
End With