求助,Excel2003代码问题,非常感谢!

如题所述

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tr, tc
tr = Target.Row
tc = Target.Column
If tr >= 2 And tc = 105 And [CX21] = "上" Then
[dc1] = [dc1] + 1
x = [dc1] Mod 2
If Cells(tr, tc) <> "" And x = 1 Then
Sheets(1).[r28] = Cells(tr, tc)
End If
If Cells(tr, tc) <> "" And x = 0 Then
Sheets(1).[r27] = Cells(tr, tc)
End If
End If

'--------------
If tr >= 2 And tc = 105 And [CX21] = "下" Then
[dc2] = [dc2] + 1
Y = [dc2] Mod 2
If Cells(tr, tc) <> "" And Y = 1 Then
Sheets(1).[S28] = Cells(tr, tc)
End If
If Cells(tr, tc) <> "" And Y = 0 Then
Sheets(1).[s27] = Cells(tr, tc)
End If
End If
End Sub
放到Sheet2vba窗口
温馨提示:答案为网友推荐,仅供参考
相似回答