다른 시트의 셀 값을 기준으로 특정 시트를 잠 그거나 잠금 해제하려고합니다. 그러나시트가 의도 한대로 작동하지 않습니다.
Application.ScreenUpdating = False
Status = Sheets("form").Range("J2")
If Status = "Active" Then
Sheets("overview").Unprotect "password"
'MsgBox "The template is now unlocked"
Else
Sheets("overview").Protect "password"
'MsgBox "The template is locked"
End If
Application.ScreenUpdating = True
, Status
는 다른 난 여전히 "레인지 클래스의 숨겨진 속성을 설정할 수 없습니다"는 점점 overview
일부 세포를 변경할 수 있습니다 active
보다 : 나는 시트 form
에 대한 워크 시트 변경에 다음 코드를 썼다 팝업. 어디서 오류가 있습니까?
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Status = Me.Range("J2")
If Status = "Active" Then
Sheets("overview").Unprotect "password"
'MsgBox "The template is now unlocked"
Else
Sheets("overview").Protect "password"
'MsgBox "The template is locked"
End If
Application.ScreenUpdating = True
End Sub
당신이 코드를 작성한 않습니다 –
아래 코드를 시도해 보면,'form' 워크 시트에서 "J2"셀의 값을 변경할 때 작동합니다. –
관련이 있는지는 잘 모르겠지만 J2의 값은 드롭 다운 목록에서 선택할 수 있습니다. –