Deselecting specific row/cell/column from selected cells

S

Skyline

I have a workbook I am working on for work. I have to select everything and
then deselect ONLY the first row. Is there anyway I can do this in Excel.
I have to select everything 1.) because I am trying to macro most of the
work, and 2.) row one contains only headers I don't want in my sort/filter.

I thought the deselect was the same as select(ctl+click/drag or
shift+click/drag) but its not.

Can someone please help

Thanks,
CJ
 
C

CyberTaz

Well CJ, first of all a caption row shouldn't interfere with a sort or a
filter if they're done properly - In fact, both the AutoFilter & the
Advanced *require* that a header row be included in the data range.

Secondly - I am *not* the macro guy - but I don't see why the whole sheet
would have to be selected to run a macro. What could you be doing that has
to affect 16,776,960 cells at a time? There must be another, more efficient
way to accomplish what you're trying to do:)

Third, you can deselect just the first (or any bordering) row or column, but
the location of the active cell in the range is the key. If the Active Cell
is in the very last row of the selected range, Shift+Down Arrow will
deselect the top row in the range.

If you post back with details of what you're trying to do perhaps there may
be a few suggestions to be had.

Regards |:>)
Bob Jones
[MVP] Office:Mac
 
J

JE McGimpsey

Skyline said:
I have a workbook I am working on for work. I have to select everything and
then deselect ONLY the first row. Is there anyway I can do this in Excel.
I have to select everything 1.) because I am trying to macro most of the
work, and 2.) row one contains only headers I don't want in my sort/filter.

I thought the deselect was the same as select(ctl+click/drag or
shift+click/drag) but its not.

First, one can never "deselect" a cell. Instead, one makes a new
selection (that may contain fewer cells).

Second, if you're going to use macros, you should probably not use
selections at all. Using the range objects directly gives you shorter,
faster, and IMNSHO, easier to maintain code.

For instance, if you're selecting the cells in the region around A1
(say, A1:Jxxx), then "deselecting" row 1 (i.e, selecting A2:Jxxxx), you
could, instead of:

Range("A1").CurrentRegion.Select
Selection.Offset(1, 0).Resize( _
Selection.Rows.Count - 1, Selection.Columns.Count).Select
Selection.Sort _
Key1:=Range("A2"), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom

use the simpler

Range("A1").CurrentRegion.Sort _
Key1:=Range("A1"), _
Order1:=xlAscending, _
Header:=xlYes, _
OrderCustom:=1, _
MatchCase:=False, _
Orentation:=xlTopToBottom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top