|
修改以下语句,“pppp”改为你的密码:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 And Target.Row > 6 And Target.Count = 1 Then
Unprotect Password:="pppp"
ARR = Sheet2.Range("A2:B" & Sheet2.Range("A65536").End(3).Row)
For I = 1 To UBound(ARR)
If ARR(I, 1) = Target Then CP = CP & ARR(I, 2) & ","
Next
CP = Left(CP, Len(CP) - 1)
With Target.Offset(0, 1).Validation
.Delete
.Add Type:=xlValidateList, _
Operator:=xlBetween, Formula1:=CP
End With
Protect Password:="pppp"
End If
End Sub
|
|