Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unlocking Protected Cells Biff Excel Worksheet Functions 1 January 12th 09 07:38 PM
Unlocking cells maltagirl Excel Discussion (Misc queries) 3 June 16th 08 07:20 PM
Unlocking protected cells Vanilla Skies Excel Worksheet Functions 0 September 26th 06 04:04 AM
Unlocking cells Vanilla Skies Excel Worksheet Functions 1 September 25th 06 04:30 AM
conditional unlocking of cells hiryuu Excel Worksheet Functions 1 October 19th 05 12:44 PM


All times are GMT +1. The time now is 06:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"