Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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 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
Unlocking Cells Sisilla Excel Programming 1 July 18th 03 08:58 PM


All times are GMT +1. The time now is 04:47 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"