G
greencecil
Hi,
I am trying to write a macro that asks a user if they are sure they have
entered the right data, when they answer yes, I want the macro to lock cells
in another spreadsheet. This spreadsheet is password protected, so the user
can only enter data into the cells I now wish to lock. The password example I
give here is ABC. I have written the following code, but get errors.
Sub LockValues()
' Lock the values entered in cells D6 to D23 in Worksheet 1
If MsgBox("Are you sure your entries are " _
& "correct and complete?", vbYesNo) = vbYes _
Then Sheets("Worksheet 1").Select
ActiveSheet.Unprotect Password:="ABC"
Range("D623").Select
Selection.Locked = True
ActiveSheet.Protect "ABC"
End Sub
Can someone advise me what changes I should make?
Thanks
I am trying to write a macro that asks a user if they are sure they have
entered the right data, when they answer yes, I want the macro to lock cells
in another spreadsheet. This spreadsheet is password protected, so the user
can only enter data into the cells I now wish to lock. The password example I
give here is ABC. I have written the following code, but get errors.
Sub LockValues()
' Lock the values entered in cells D6 to D23 in Worksheet 1
If MsgBox("Are you sure your entries are " _
& "correct and complete?", vbYesNo) = vbYes _
Then Sheets("Worksheet 1").Select
ActiveSheet.Unprotect Password:="ABC"
Range("D623").Select
Selection.Locked = True
ActiveSheet.Protect "ABC"
End Sub
Can someone advise me what changes I should make?
Thanks