Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error: Cannot Set Range Class Property


I've been trying to Get Excel to Change Worksheet Protection Passwor
using the -Locked Property -without success.

THIS IS THE SITUATION

*1.* I had the properties (format) of specific ranges set t
'Unlocked'
*2.* I then protected the Worksheet containing those ranges with
password
*3.* I now tried to unlock the Worksheet and set those specific cell
to 'locked' *programmatically*
e.g

Code
-------------------
worksheet(1).Unprotect('the password')
worksheets(1).range("X11:Y34").locked = Fals
-------------------

where range("X11:Y34") represents the specific unlocked cells

RESULT
I get and Error Message:
Run-time Error 1004. Could not set Range Class property.

What did I do wrong

--
2hO
-----------------------------------------------------------------------
2hOt's Profile: http://www.excelforum.com/member.php...fo&userid=3697
View this thread: http://www.excelforum.com/showthread.php?threadid=56698

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Error: Cannot Set Range Class Property

Hi
you shouldn't have parenthesis on the unprotect:

Worksheets(1).Unprotect Password:="My Password"

The locked stuff looks OK.
regards
Paul

2hOt wrote:
I've been trying to Get Excel to Change Worksheet Protection Password
using the -Locked Property -without success.

THIS IS THE SITUATION:

*1.* I had the properties (format) of specific ranges set to
'Unlocked'
*2.* I then protected the Worksheet containing those ranges with a
password
*3.* I now tried to unlock the Worksheet and set those specific cells
to 'locked' *programmatically*
e.g

Code:
--------------------
worksheet(1).Unprotect('the password')
worksheets(1).range("X11:Y34").locked = False
--------------------

where range("X11:Y34") represents the specific unlocked cells

RESULT:
I get and Error Message:
Run-time Error 1004. Could not set Range Class property.

What did I do wrong?


--
2hOt
------------------------------------------------------------------------
2hOt's Profile: http://www.excelforum.com/member.php...o&userid=36977
View this thread: http://www.excelforum.com/showthread...hreadid=566981


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Error: Cannot Set Range Class Property

The parentheses do not matter, its just a shortcut way since the only
argument Unprotect requires is the password. I copied and ran your
code exactly, with the exception of worksheet(1) should be
worksheets(1)... it ran fine for me. I think your problem might be
somewhere else.


wrote:
Hi
you shouldn't have parenthesis on the unprotect:

Worksheets(1).Unprotect Password:="My Password"

The locked stuff looks OK.
regards
Paul

2hOt wrote:
I've been trying to Get Excel to Change Worksheet Protection Password
using the -Locked Property -without success.

THIS IS THE SITUATION:

*1.* I had the properties (format) of specific ranges set to
'Unlocked'
*2.* I then protected the Worksheet containing those ranges with a
password
*3.* I now tried to unlock the Worksheet and set those specific cells
to 'locked' *programmatically*
e.g

Code:
--------------------
worksheet(1).Unprotect('the password')
worksheets(1).range("X11:Y34").locked = False
--------------------

where range("X11:Y34") represents the specific unlocked cells

RESULT:
I get and Error Message:
Run-time Error 1004. Could not set Range Class property.

What did I do wrong?


--
2hOt
------------------------------------------------------------------------
2hOt's Profile:
http://www.excelforum.com/member.php...o&userid=36977
View this thread: http://www.excelforum.com/showthread...hreadid=566981


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
Error:Unable to set the visible property of the PivotItem class. Holger Pietsch Excel Programming 2 August 16th 05 05:11 PM
Help - Error: Unable to set the PrintArea property of the PageSetup class Marie J-son[_5_] Excel Programming 3 January 5th 05 02:04 PM
Cannot set HorizontalAlignment Property of the Range Class Alan Excel Programming 10 December 10th 04 12:57 AM
Unable to set the NumberFormat Property of the Range Class - ERROR Jon Delano Excel Programming 3 November 10th 04 07:33 PM
Unable to set the colorIndex Property of the Interior Class Error GriffyGriff Excel Programming 3 October 3rd 03 04:37 PM


All times are GMT +1. The time now is 07:40 PM.

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"