Option Explicit
Sub DataChanes()
Dim Msg As String, Title As String
Dim Config As Integer, Ans As Integer
Msg = "Are You Sure ?"
Msg = Msg & vbNewLine & vbNewLine
Msg = Msg & "Review your entries - Cells will be locked and changes cannot be undone." & vbCrLf & vbCrLf & _
"Click YES to finalize your entries. Click NO to make changes."
Title = "Data Changes"
Config = vbYesNo + vbExclamation
Ans = MsgBox(Msg, Config, Title)
If Ans = vbYes Then
CellProtect
End If
If Ans = vbNo Then Exit Sub
End Sub
Sub CellProtect()
Dim Blatt As Worksheet, rng As Range
Set Blatt = Worksheets("Sheet1")
Set rng = Blatt.Range(Cells(1, 1), Cells(3, 7))
rng.Select
Blatt.Unprotect
Blatt.Cells.Locked = False
rng.Locked = True
Blatt.Protect
End Sub
Sub CellUnProtect()
Dim Blatt As Worksheet, rng As Range
Set Blatt = Worksheets("Sheet1")
Set rng = Blatt.Range(Cells(1, 1), Cells(3, 7))
rng.Select
Blatt.Unprotect
Blatt.Cells.Locked = False
rng.Locked = False
'Blatt.Protect
End Sub