Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unlocking Cells
The cell that is not being changed is my cell link for my
drop-down. The other cells are being changed even if the sheet has been protected. I believe that this might be due to the fact that my cell link is changed as soon as the drop-down is clicked, and before the macro is run; the sheet is therefore protected and the cell locked at that time. The only option I can think of is to place my cell link on a different sheet since the user does not have to see this information. Are there any other options? I really would not like to have to create another sheet for my cell link. I appreciate any help. Thanks, Sisilla ----Original 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 . |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unlocking Cells
If you are trying to unlock the cell that is linked to a control when the
control fires its click or change event, then it probably is being changed, like all the others, but after the fact as you describe. You can unlink you cell and use your code to set the value. Don't know what type of control you are using, so can't say what the propert code would be but lets say a combobox from the control toolbox toobar Private Sub Combobox1_Click() Activesheet.Protect UserInterfaceOnly:=True Range("B9").Value = Combobox1.Value End Sub I would have already cleared the linked cell entry in the properties window. Activesheet.Protect UserInterfaceOnly:=True requires a password argument if a password is assigned in Excel 2002 - but not in earlier versions. Regards, Tom Ogilvy "Sisilla" wrote in message ... The cell that is not being changed is my cell link for my drop-down. The other cells are being changed even if the sheet has been protected. I believe that this might be due to the fact that my cell link is changed as soon as the drop-down is clicked, and before the macro is run; the sheet is therefore protected and the cell locked at that time. The only option I can think of is to place my cell link on a different sheet since the user does not have to see this information. Are there any other options? I really would not like to have to create another sheet for my cell link. I appreciate any help. Thanks, Sisilla ----Original 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 Protected Cells | Excel Worksheet Functions | |||
Unlocking cells | Excel Discussion (Misc queries) | |||
Unlocking protected cells | Excel Worksheet Functions | |||
Unlocking cells | Excel Worksheet Functions | |||
conditional unlocking of cells | Excel Worksheet Functions |