Sub 重覆選課()
'取列
i = 1
Range("C2").Select
Selection.End(xlDown).Select
x = ActiveCell.Row
rx = "a1:y" & x
'排序
Range("C2").Select
Range(rx).Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:= _
Range("D2"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, SortMethod:=xlStroke, _
DataOption1:=xlSortNormal, DataOption2:=xlSortNormal
Range("C2").Select
While (i <> x)
If ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
ActiveCell.Offset(0, 1).Select
If ActiveCell.Value = ActiveCell.Offset(1, 0).Value Then
ActiveCell.Offset(0, 21).Value = "重覆選課"
ActiveCell.Offset(1, 21).Value = "重覆選課"
ActiveCell.Offset(0, -1).Select
Else
ActiveCell.Offset(0, -1).Select
End If
End If
ActiveCell.Offset(1, 0).Select
i = i + 1
Wend
'還原
Range("A2").Select
Range(rx).Sort Key1:=Range("A2"), Order1:=xlAscending, Header _
:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom _
, SortMethod:=xlStroke, DataOption1:=xlSortNormal
End Sub
>即時新聞-熱門
2009年6月14日星期日
EXCELVBA - 重覆選課
发帖者 ALEX 时间: 16:03
订阅:
博文评论 (Atom)
1 评论:
Uѕеful іnfo. Lucκy mе I discovered уouг web sitе unintentiοnаlly, аnd I аm stunned
why this аccіdеnt ԁid not took placе in adνance!
І bοokmarkеd іt.
Alѕo visit my blog post ... iphonerepairkl.my
发表评论