در این پست آموزش دریافت کلمه رمز عبور از کاربر به منظور ویرایش اطلاعات را خواهیم آموخت :
Sub UnlockRange()
Dim MyUnlock As String
Dim MyRng As Range
Dim Mycell As Range
If (InputBox("Please Enter Password") = "92bp55") Then
ActiveSheet.Unprotect "92bp55"
'Enter ALL Cells to be unlocked seperated by Commas
MyUnlock = "J4:J6,I7:J14,E8,B17:I36,B38:E43,F38:F42,G38:H43,J38,J42,B46:J57,C66,D66,I66"
With ActiveSheet
Set MyRng = .Range(MyUnlock)
For Each Mycell In MyRng.Cells
If Mycell.Locked = True Then
Mycell.MergeArea.Locked = False
End If
Next Mycell
End With
ActiveSheet.Protect "92bp55"
Else
MsgBox "You are not able to Reopen this Invoice, Please contact an Administrator"
End If
End Sub
ورود به سایت