Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default deselect row/column from multiple selection

Selecting multiple non-adjacent rows with control click. How do I deselect
one of them.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default deselect row/column from multiple selection

Try this macro:

Sub DropARow()
Set r1 = Selection
n = Application.InputBox(prompt:="enter row# to be de-selected", Type:=1)
Set r2 = Range(n & ":" & n)
Set r3 = Nothing
For Each rr In r1
If Intersect(rr, r2) Is Nothing Then
If r3 Is Nothing Then
Set r3 = rr
Else
Set r3 = Union(r3, rr)
End If
End If
Next
r3.Select
End Sub

--
Gary''s Student - gsnu200836


"Alan C" wrote:

Selecting multiple non-adjacent rows with control click. How do I deselect
one of them.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default deselect row/column from multiple selection

And a couple more from Chip Pearson.

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 Thu, 5 Mar 2009 06:30:01 -0800, Gary''s Student
wrote:

Try this macro:

Sub DropARow()
Set r1 = Selection
n = Application.InputBox(prompt:="enter row# to be de-selected", Type:=1)
Set r2 = Range(n & ":" & n)
Set r3 = Nothing
For Each rr In r1
If Intersect(rr, r2) Is Nothing Then
If r3 Is Nothing Then
Set r3 = rr
Else
Set r3 = Union(r3, rr)
End If
End If
Next
r3.Select
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple selection AND Excel Discussion (Misc queries) 9 February 13th 09 07:40 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM
Multiple Column selection in pivot tables [email protected] Excel Discussion (Misc queries) 0 June 20th 07 08:27 PM
how can I deselect one of the multiple selected rows? jopieb123 Excel Discussion (Misc queries) 3 December 1st 05 03:50 PM
ActiveChart.Deselect won't Deselect Mark Stephens Charts and Charting in Excel 2 June 16th 05 02:54 AM


All times are GMT +1. The time now is 06:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"