sorting questions

B

BruceJ

I am leary of sorting as I have had my data "corrupted" becuase I apparently
had some heading columns with out names.
How can I sort data (or present it in a given order-sort might not be the
best working). I use user forms and I would need to move between records
with the userforms. I know I will probably need to reprogram my
"next/previous buttons, but how can I ensure my data does not get corrupted,
and present my data in a specified order?

Is sorting safe? What do I need to know in order to do it safely?

I am not sure if this is the "best" formum for this question in it's
entirerty, but some would be appropiate here and I know you guys know Excel
better than the general forums.


Thanks,
Bruce
 
G

GB

Hi Bruce

The general rule for safety is to highlight your entire block of data before
sorting. Otherwise, Excel tries to work out the extent of your data block
for you - not always in the way you intended, as you have found to your
cost.

HTH

GB
 
S

steve

I try to set up my sheets such that I can select entire rows and not miss
any of the columns.

Or from code - make doubly sure that ALL the data is selected before
sorting.

I have seen some instances where formulas didn't seem to follow the sort
on some of my sheets. And this is still a mystery to me. (But then I do
have some strange formulas).
 
B

BruceJ

How would I modify the following to make _SURE_ everything is selected and
would not "corrupt" my data?

Sub Sort_RecNo()
'
' Sort_RecNo Macro
' Macro recorded 10/18/2003 by
'

'
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub


Thanks!
Bruce
 
B

BruceJ

So this is a SAFE way to sort? I have lost LOTS of data (meaning leads,
sales, money and time!) due to it getting messed up with sorts, so I have
been VERY leary since I found out about this "feature" of excel. Since I am
not sure of all of the issues I really need to make sure of what I am doing.

Each column does have a name, upto were data ends (not unique) empty columns
have headers of "notused". I think everything else is unique though. I have
not heard that unique headers are required, but again, I just want to make
sure....

I have not been sorting, just filtering, and then hunting through manually
to find the records I need. Not very good...


Thanks,
Gunshy Bruce
 
D

Dave Peterson

If you have one header row (or no header rows) and the data is all used the
same, it sure sounds safe to me.

But for a lot of the stuff I do, I have multiple headers and sometimes the data
changes at the bottom--like footnotes.

I like to be a little more specific with my selection. I'll hit ctrl-end to get
near the bottom right corner and then click on the real bottom right corner.
Then I'll use ctrl-Shift-Home to get close to the upper-left-corner. Then I'll
shift-click on that.

Then when I do Data|sort, I can verify that I included (or didn't include the
last header row).

And if you're not confident about this stuff, save a copy first. Then do your
sort. You can always close without saving if you screwed it up too badly.
 
Top