我希望在使用index-match
公式匹配条件时解锁单元格。
我尝试了很多,但它没有用。你能告诉我我的错误吗?
Private Sub Worksheet_ChangeS(ByVal Target As Range)
If[X9] > "42401" Then
ActiveSheet.Unprotect("pswrd")[ = INDEX(A16: L35, MATCH(X9, A16: A35, 0), MATCH("GPF", A16: L16, 0))].Locked = False
ActiveSheet.Protect("pswrd")
Else
ActiveSheet.Unprotect("pswrd")[ = INDEX(A16: L35, MATCH(X9, A16: A35, 0), MATCH("GPF", A16: L16, 0))].Locked = True
ActiveSheet.Protect("pswrd")
End If
End Sub