Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default use macro on a protected sheet

If i protect a worksheet the macro is not executing. it is giving error
message as
Run-Time Error 1004
You cannot use this command in a protected sheet.

kindly suggest the procedure to execute the macro in a protected sheet. i
want to protect some cells in the sheet from being uptaion.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default use macro on a protected sheet

Hi

you'll need to uprotect the sheet at the start of the macro and protect it
again at the end
e.g.

sub mymacro()

activesheet.unprotect ("pwd")
'current code

activesheet.protect ("pwd")
end sub

where pwd is your password

Cheers
JulieD


"das.s.k" wrote in message
...
If i protect a worksheet the macro is not executing. it is giving error
message as
Run-Time Error 1004
You cannot use this command in a protected sheet.

kindly suggest the procedure to execute the macro in a protected sheet. i
want to protect some cells in the sheet from being uptaion.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default use macro on a protected sheet

If you are protecting the worksheet from the VBA code you
might try this:

Dim x as Boolean

x = Worhsheets(1).Protect_
(DrawingObjects:=True, Contents:=True, _
Scenarios:=True, UserInterfaceOnly:=True)

The last arg sets the protection so that a macro can alter
the sheet but a user cannot.

Hope this helps

Tony
-----Original Message-----
If i protect a worksheet the macro is not executing. it

is giving error
message as
Run-Time Error 1004
You cannot use this command in a protected sheet.

kindly suggest the procedure to execute the macro in a

protected sheet. i
want to protect some cells in the sheet from being

uptaion.
.

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
Macro & Protected sheet Lise Excel Discussion (Misc queries) 2 April 11th 10 10:36 PM
use macro button to run macro in protected sheet earl Excel Discussion (Misc queries) 3 February 26th 06 10:21 PM
Macro Errs when sheet is protected Skankles Excel Worksheet Functions 1 February 10th 05 06:44 PM
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet arunjoshi[_5_] Excel Programming 1 May 2nd 04 03:50 PM
Using a Macro with the sheet protected. Jason Watts Excel Programming 1 January 6th 04 09:31 PM


All times are GMT +1. The time now is 02:44 AM.

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

About Us

"It's about Microsoft Excel"