标题: 在sheet1中做控件按钮对sheet2,3排序,结果sheet1也给排序了,为什么? [打印本页] 作者: 飘零红叶 时间: 2006-6-23 21:58 标题: 在sheet1中做控件按钮对sheet2,3排序,结果sheet1也给排序了,为什么? Sheets("AAA").Select
Range("A1:B2000").Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range( _
"B1"), Order2:=xlAscending
For i = 2 To s
For j = 1 To 10
If Cells(i, 1) = Cells(i + j, 1) Then
Cells(i, 2) = Cells(i + j, 2) + Cells(i, 2)
Rows(i + j).ClearContents
End If
Next j
Next i
Sheets("BBB").Select
Range("A1:B2000").Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range( _
"B1"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase _
:=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin, DataOption1:= _
xlSortNormal, DataOption2:=xlSortNormal
For i = 2 To t
For j = 1 To 10
If Cells(i, 1) = Cells(i + j, 1) Then
Cells(i, 2) = Cells(i + j, 2) + Cells(i, 2)
Rows(i + j).ClearContents
End If
Next j
Next i
Sheets("CCC").Select
Range("A1:B2000").Sort Key1:=Range("A1"), Order1:=xlAscending, Key2:=Range( _
"B1"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase _
:=False, Orientation:=xlTopToBottom, SortMethod:=xlPinYin, DataOption1:= _
xlSortNormal, DataOption2:=xlSortNormal
For i = 2 To u
For j = 1 To 10
If Cells(i, 1) = Cells(i + j, 1) Then
Cells(i, 2) = Cells(i + j, 2) + Cells(i, 2)
Rows(i + j).ClearContents
End If
Next j
Next i