nkechifesie
07-24-2007, 02:21 AM
I have an excel sheet containing some indictators which I sort to help me analyse my system. After running the macro I discovered that some columns no longer have the right values , like it didnt sort well, probably sort just one column without carrying the other columns related to it.
e.g, lets say I have these columns and i want to sort by age DESCENDING
NAME SURNAME AGE
JACK JILL 20
PETER PAUL 21
It gives me
NAME SURNAME AGE
PETER JILL 21
JACK PAUL 20
this is a part of the code and after the sort is where the problem occurs.
Sheets("No Counters").Rows(1).Value = Sheets("Matrix sheet").Rows(1).Value
Sheets("Matrix sheet").Select
Columns("E:E").Select
Range("A1:CN" & Cells(Rows.Count, 1).End(xlDown).Row).Sort key1:=Range("E1"), order1:=xlDescending, header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
thanks for your help
e.g, lets say I have these columns and i want to sort by age DESCENDING
NAME SURNAME AGE
JACK JILL 20
PETER PAUL 21
It gives me
NAME SURNAME AGE
PETER JILL 21
JACK PAUL 20
this is a part of the code and after the sort is where the problem occurs.
Sheets("No Counters").Rows(1).Value = Sheets("Matrix sheet").Rows(1).Value
Sheets("Matrix sheet").Select
Columns("E:E").Select
Range("A1:CN" & Cells(Rows.Count, 1).End(xlDown).Row).Sort key1:=Range("E1"), order1:=xlDescending, header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
thanks for your help