13 replies
by it_cowboy
To unprotect individual cells, highlight them and go Format > Cells, click on the Protection Tab and uncheck the 'locked' box.
To write your macro, just go Tools > Macro > Record New Macro and record the keystrokes you want your macro to perform.
I'd say you want one macro to unprotect the cells for input, the other macro to apply the protection again. You will need to do this in conjunction with Protecting the Worksheet.
For Example:
Sheet should be protected before you begin.
Macro 1
Unprotect Worksheet (Tools > Protection > UnProtect Sheet).
Select Cells and uncheck 'locked' box.
Macro 2
Select Cells and check 'locked' box
Protect Worksheet.
To add some buttons, click on View > Toolbars > Forms.
Attach your macros to the buttons.
Good Luck!
by it_cowboy
just realised, you will need to protect the sheet again...
Macro 1
Unprotect Worksheet (Tools > Protection > UnProtect Sheet).
Select Cells and uncheck 'locked' box.
Protect Worksheet.
Macro 2
Unprotect Worksheet (Tools > Protection >UnProtect Sheet).
Select Cells and check 'locked' box
Protect Worksheet.
by snuffy smif
by snuffy smif
by kbarry
Greg mentioned the simplest method. To do all of the things that you want to do will require some time in VBA. Play around with the resord macro feature. Seeing the syntax develop, and using controlled tests, will allow you to create the spreadsheet you want. Another alternative is to create a form that pops up when the user tries to edit a cell. Then have the cells dynamically linked to a hidden sheet that records the entries to the form. That will allow you to protect everything the user can see, and give you the flexability with the data.
Have fun with it! :)
Hope this helps.
by snuffy smif
by snuffy smif
by sankulpune
Hello snuffy smif,
1) Using Format > Cells > Protection, un-lock all the cells in the worksheet.
2) Lock only those cells that you want to protect.
3) Using Tools > Protection > Protect Sheet, protect the sheet. Remember the Password('SSK' for example).
4) In the SelectionChange Event of the WorkSheet, paste the code:
'----
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Locked = True Then
If InputBox("Type Password") <> "SSK" Then
MsgBox "Locked !"
Else
ActiveSheet.Unprotect "SSK"
End If
Else
ActiveSheet.Protect "SSK"
End If
End Sub
'----
I have successfully tried this could and would be happy to help you implement it.
Your early response will be highly appreciated.
With best personal regards,
SanganakSakha,
Your Friend In Need.
by snuffy smif
by parier
Why fuss with protecting and unprotecting all that when you can make a simple form in access to all the things you want users to fill out. You can also link your Access form to the excel spreadsheet you are currently using. This was nobody can edit anything and all the data is neat and by setting up before hand, the formatting is to your liking. If you like I can create it, send the excel spreadsheet and I will start it up and email it to you and we can do it together.
eparisek@mtga.com
by snuffy smif
by snuffy smif
This discussion is closed to new replies.
Trending Software posts
Sort by Trending