- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¦^´_ 22# aassddff736
¥H¤U¬O ¾Ç²ß¸ê®ÆÅçÃÒ²M³æªº¤èªk,½Ð«e½ú°Ñ¦Ò
Àx¦ìªÅ¦ì¦s©ñ°Ï²M³æ:
Àx¦ìªÅ¦ì²M³æ:
±N¥H¤U¥N½X´Ó¤J ¥D¶ ¤u§@ªí¼Ò²Õ¤U
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
Dim Ad$, Arr, Z, xR As Range, i&
Set Arr = Intersect([¥D¶!B17].CurrentRegion, [¥D¶!B18:D65536])
If Me.UsedRange.Rows.Count <= 17 Then Exit Sub
If .Columns.Count > 1 Then Exit Sub
Set xR = Intersect(Arr.Resize(, 1), .Cells): Arr.Resize(, 2).Validation.Delete
If Not xR Is Nothing Then
If .Count > 1 Then Exit Sub
If Trim(.Value) = "" Then Exit Sub Else Arr = Arr
Set Z = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(Arr)
If Arr(i, 1) = .Value And Arr(i, 3) = "" Then Z(Arr(i, 2)) = ""
Next
With .Item(1, 2).Validation
If Z.Count > 0 Then .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Join(Z.KEYS(), ",")
End With
Set Z = Nothing: Arr = Empty: Exit Sub
End If
Set xR = Intersect(Arr.Resize(, 2), .Cells)
If Not xR Is Nothing Then
If .Count > 1 Then Exit Sub
If .Value = "" Then Exit Sub Else Arr = Arr
Set Z = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(Arr): Z(Arr(i, 1) & "/" & Arr(i, 2)) = i + 17: Next
If Z.EXISTS(.Item(1, 0) & "/" & .Value) Then Rows(Z(.Item(1, 0) & "/" & .Value)).Delete
Ad = .Cells(1, 2).Hyperlinks(1).SubAddress
Application.Goto Sheets(Split(Ad, "!")(0)).Range(Split(Ad, "!")(1))
Selection(1) = .Value: Set Z = Nothing: Arr = Empty
End If
End With
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Arr, Z, i&, xR As Range
With Target
Set Arr = Intersect([¥D¶!B17].CurrentRegion, [¥D¶!B18:D65536])
Set xR = Intersect(Arr.Resize(, 1), .Cells): Arr.Resize(, 1).Validation.Delete: Arr = Arr
If Not xR Is Nothing Then
Set Z = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(Arr)
If Arr(i, 1) <> "" And Arr(i, 3) = "" Then Z(Arr(i, 1)) = ""
Next
With .Validation
If Z.Count > 0 Then .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Join(Z.KEYS(), ","): Set Z = Nothing: Arr = Empty
End With
End If
End With
End Sub |
|