|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c, d, R
c = Selection.Column()
d = Selection.Row()
R = Range("A65536").End(xlUp).Row
On Error Resume Next
If c = 3 And d = 2 Then
With Range("A3:V" & R)
.Sort [C2], 1 '1升序
End With
End If
If c = 4 And d = 2 Then
With Range("A3:V" & R)
.Sort [D2], 1 '1升序
End With
End If
If c = 5 And d = 2 Then
With Range("A3:V" & R)
.Sort [E2], 1 '1升序
End With
End If
If c = 6 And d = 2 Then
With Range("A3:V" & R)
.Sort [F2], 1 '1升序
End With
End If
If c = 7 And d = 2 Then
With Range("A3:V" & R)
.Sort [G2], 1 '1升序
End With
End If
If c = 8 And d = 2 Then
With Range("A3:V" & R)
.Sort [H2], 1 '1升序
End With
End If
If c = 9 And d = 2 Then
With Range("A3:V" & R)
.Sort [I2], 1 '1升序
End With
End If
If c = 10 And d = 2 Then
With Range("A3:V" & R)
.Sort [J2], 1 '1升序
End With
End If
If c = 11 And d = 2 Then
With Range("A3:V" & R)
.Sort [K2], 1 '1升序
End With
End If
If c = 12 And d = 2 Then
With Range("A3:V" & R)
.Sort [L2], 1 '1升序
End With
End If
If c = 13 And d = 2 Then
With Range("A3:V" & R)
.Sort [M2], 1 '1升序
End With
End If
If c = 14 And d = 2 Then
With Range("A3:V" & R)
.Sort [N2], 1 '1升序
End With
End If
If c = 15 And d = 2 Then
With Range("A3:V" & R)
.Sort [O2], 1 '1升序
End With
End If
If c = 16 And d = 2 Then
With Range("A3:V" & R)
.Sort [P2], 1 '1升序
End With
End If
If c = 17 And d = 2 Then
With Range("A3:V" & R)
.Sort [Q2], 1 '1升序
End With
End If
If c = 18 And d = 2 Then
With Range("A3:V" & R)
.Sort [R2], 1 '1升序
End With
End If
If c = 19 And d = 2 Then
With Range("A3:V" & R)
.Sort [S2], 1 '1升序
End With
End If
If c = 20 And d = 2 Then
With Range("A3:V" & R)
.Sort [T2], 1 '1升序
End With
End If
If c = 21 And d = 2 Then
With Range("A3:V" & R)
.Sort [U2], 1 '1升序
End With
End If
If c = 22 And d = 2 Then
With Range("A3:V" & R)
.Sort [V2], 1 '1升序
End With
End If
Application.ScreenUpdating = True
End Sub
|
|