Automatic Cell Locking

  • 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!!!
 
Check your other post.

FARAZ said:
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!!!
 
Faraz,
Right-click on the A at the top of column A. Select Format Cells. On the
protection tab, uncheck Locked. This will prevent column A from being
protected. Your button code:

Sub LockIt()
If MsgBox("Are you sure your entries are " _
& "correct and complete?", vbYesNo) = vbYes _
Then ActiveSheet.Protect "abc"
End Sub

Put this code in a standard module. Insert a button from the forms toolbar
on the worksheet and assign this macro to it. The "abc" is the password.
Change as desired. Hope this helps! James
 
You can use the following code on command click event ....

If MsgBox("Your Message.....", vbYesNo) = vbYes Then
Columns("A:A").Select
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End If

:) have fun!!!!!!!

Gaurav Kothari
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top