Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Deselecting unwanted cells
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? |
#2
|
|||
|
|||
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? |
#3
|
|||
|
|||
This seems very sophisticated and complicated for novices. Dones not excell
has a tool or a built in command to do this? "Paul B" wrote in message ... 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? |
#4
|
|||
|
|||
Octavio, not that I am aware of,
To put in this macro, from your workbook right-click the workbook's icon and pick View Code. This icon is to the left of the "File" menu this will open the VBA editor, in the left hand window click on your workbook name, go to insert, module, and paste the code in the window that opens on the right hand side, press Alt and Q to close this window and go back to your workbook and press alt and F8, this will bring up a box to pick the Macro from, click on the Macro name to run it. If you are using excel 2000 or newer you may have to change the macro security settings to get the macro to run. To change the security settings go to tools, macro, security, security level and set it to medium. You may also what to have a look here on getting started with macros http://www.mvps.org/dmcritchie/excel/getstarted.htm -- 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 ... This seems very sophisticated and complicated for novices. Dones not excell has a tool or a built in command to do this? "Paul B" wrote in message ... 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help adding text values | Excel Worksheet Functions | |||
Convert data type of cells to Text,Number,Date and Time | Excel Worksheet Functions | |||
To safety merge cells without data destroyed, and smart unmerge! | Excel Discussion (Misc queries) | |||
Heps to design Locked/Unlocked cells in protected worksheet | Excel Discussion (Misc queries) | |||
Convert data of cells to any type: Number, Date&Time, Text | Excel Discussion (Misc queries) |