CELLS TO BE AUTOMATICALLY LOCKED

  • Thread starter Thread starter FARAZ QURESHI
  • Start date Start date
F

FARAZ QURESHI

Dear friends your expertise is required for a piece of code that would be
attached with a button which upon being clicked shall ask in a msgbox:
"You sure the information is complete and correct?"
and upon clicking the "YES" all the entries would be frozen / cells locked,
except for a column A:A.

Thanx Guys!!!
 
Maybe...

Option Explicit
Sub testme()

Dim resp As Long

With ActiveSheet
If .ProtectContents = True Then
'already protected
Exit Sub
End If

resp = MsgBox(Prompt:="Are you sure?", Buttons:=vbYesNo)
If resp = vbNo Then Exit Sub


.Cells.Locked = True
.Range("A1").EntireColumn.Locked = False
.Protect Password:="hi"
End With
End Sub
 
Back
Top