ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   CELLS TO BE AUTOMATICALLY LOCKED (https://www.excelbanter.com/excel-discussion-misc-queries/168202-cells-automatically-locked.html)

FARAZ QURESHI

CELLS TO BE AUTOMATICALLY LOCKED
 
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!!!

Dave Peterson

CELLS TO BE AUTOMATICALLY LOCKED
 
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

FARAZ QURESHI wrote:

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!!!


--

Dave Peterson


All times are GMT +1. The time now is 03:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com