Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unlocking Cells
You have defined names of SelectedFormulaRow and SelectedFormula
Range("SelectedFormulaRow, SelectedFormula, G16, G18").Select Sub AAAA() ActiveSheet.Unprotect Range("SelectedFormulaRow, SelectedFormula, G16,G18 ").Select Selection.Locked = False Selection.FormulaHidden = False End Sub Worked fine for me whether the sheet was protected or unprotected (did not have a password). Regards, Tom Ogilvy "Sisilla" wrote in message ... I have code that successfully unprotects a sheet before a subroutine is run and protects it again after it is run. I have more code in the subroutine that successfully unlocks and then locks certain cells...IF THE SHEET IS MANUALLY UNPROTECTED. The code is unable to unlock those cells if the sheet is protected...EVEN THOUGH THERE IS CODE TO UNPROTECT THE SHEET! Does anyone have any ideas on what might be causing this? I am on Excel XP, VB 6.3, and Windows 2000. I do not receive a compile or run-time error. All the cells that need to be unlocked manually have been unlocked. I am positive that the message below pertains to the cells that have to be unlocked through code: The cell or chart you are trying to change is protected and therefore read-only. Here is my code: ActiveSheet.Unprotect Range("SelectedFormulaRow, SelectedFormula, G16, G18").Select Selection.Locked = False Selection.FormulaHidden = False Why will this code work only if the sheet has manually been unprotected, and are there any suggestions about code that will work even when the sheet is manually protected? I appreciate any efforts to help me. Thanks, Sisilla |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Unlocking cells | Excel Discussion (Misc queries) | |||
Unlocking protected cells | Excel Worksheet Functions | |||
Unlocking cells | Excel Worksheet Functions | |||
conditional unlocking of cells | Excel Worksheet Functions | |||
Unlocking Cells | Excel Programming |