- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-11-28
|
¦^´_ 16# jsc0518
'¬ã¨s¤F3Ó©«¤l«÷´ê¥X¤F ¤£¶µ¥Ø¼Æ¶qªº¤èªk
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
Dim Af&, Sh$, i&, Arr(), Brr(), K&, Dic As Object
Set Dic = CreateObject("scripting.dictionary")
Af = 32
If .Column = Af And .Row >= 2 And .Count = 1 Then
If ActiveSheet.FilterMode = True Then
Arr = Range("AF2:AF" & ActiveSheet.UsedRange.Rows.Count)
ReDim Brr(1 To UBound(Arr), 1 To 1)
For i = 1 To UBound(Arr)
If Rows(i).EntireRow.Hidden = True Then
If Sh = "" Then
Sh = Cells(i, "AF")
ElseIf InStr(Sh, Cells(i, "AF")) = 0 Then
Sh = Sh & "," & Cells(i, "AF")
End If
ElseIf InStr(Sh, Cells(i, "AF")) <> 0 Then
GoTo 999
ElseIf Dic.exists(Arr(i, 1)) Then
Dic(Arr(i, 1)) = ""
K = K + 1
Brr(K, 1) = Arr(i, 1)
End If
999
Next
If InStr(Sh, .Value) <> 0 Then
.Rows(.Count).EntireRow.Hidden = True
ElseIf K > 0 Then
Selection.AutoFilter Field:=Af, Criteria1:=Brr, Operator:=xlFilterValues
ActiveSheet.AutoFilter.ApplyFilter
End If
End If
End If
End With
End Sub
'²q´ú¥Í²£¬yµ{¬O «Ý®Æ>«Ý¥Í²£>¥Í²£¤¤>µ²§å ¯S®íª¬ªp ¾÷¥x²§±`or¼È°± ¥H¤U¸gÅç¨Ñ°Ñ¦Ò
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
'¦bAFÄæÀx¦s®æ¥H·Æ¹«¥ªÁä§Ö«ö¨â¦¸>>¨Ì·Ó¬yµ{ §ïÅܬyµ{¶i«×
If .Column = 32 And .Row >= 2 Then
If .Value = "«Ý®Æ" Then
.Value = "«Ý¥Í²£"
ElseIf .Value = "«Ý¥Í²£" Then
.Value = "¥Í²£¤¤"
ElseIf .Value = "¥Í²£¤¤" Then
.Value = "µ²§å"
ElseIf .Value = "µ²§å" Then
MsgBox "?"
ElseIf .Value = "¾÷¥x²§±`" Then
.Value = "¥Í²£¤¤"
ElseIf .Value = "¼È°±" Then
.Value = "¥Í²£¤¤"
End If
Cancel = True
End If
'¦bAGÄæÀx¦s®æ¥H·Æ¹«¥ªÁä§Ö«ö¨â¦¸>>§ïÅܬyµ{¯S§Oª¬ªp(¾÷¥x²§±`)
If .Column = 33 And .Row >= 2 Then
If .Cells(1, 0) = "¥Í²£¤¤" Then
.Cells(1, 0) = "¾÷¥x²§±`"
End If
Cancel = True
End If
'¦bAF1Àx¦s®æ¥H·Æ¹«¥ªÁä§Ö«ö¨â¦¸>>¸Ñ°£¥þ³¡Äæ¦ì¿z¿ï
If .Address = "$AF$1" Then
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
Cancel = True
End If
End With
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
With Target
'¦bAFÄæÀx¦s®æ«ö·Æ¹«¥kÁä>>ª½±µÀ°¦bAFÄæ¿z¿ï·í®æªº¶µ¥Ø
'EX: ¦b¨S¦³¿z¿ïªº±¡ªp¤U ¦bAF2Àx¦s®æ«ö·Æ¹«¥kÁä,¦pªGAF2ªº¤å¦r¬O "¥Í²£¤¤" ´NÀ°¦bAFÄæ¿z¿ï "¥Í²£¤¤"
If .Column = 32 And .Row >= 2 And .Count = 1 Then
If ActiveSheet.FilterMode = True Then
ActiveSheet.ShowAllData
End If
Selection.AutoFilter Field:=32, Criteria1:=.Value, Operator:=xlFilterValues
Cancel = True
End If
'¦bAGÄæÀx¦s®æ«ö·Æ¹«¥kÁä>>§ïÅܬyµ{¯S§Oª¬ªp(¼È°±)
If .Column = 33 And .Row >= 2 Then
If .Cells(1, 0) = "¥Í²£¤¤" Then
.Cells(1, 0) = "¼È°±"
End If
Cancel = True
End If
End With
°Ñ¦Ò!
End Sub |
|