Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 447
Default Copying Protected Worksheet

I have a macro that will copy one worksheet to a new one. My user wants
parts of the first worksheet protected (locked cells). When I try to run the
macro, it returns an error due to the protection. How do I write code to
unprotect the current worksheet so I can create a new one - and not have the
user enter the password??

Karen.....
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Copying Protected Worksheet

You can not copy a sheet in code that is protected (the same as you can not
copy it witout using code and just doing it manually). Why not unprotect it,
copy it and reprotect it?
--
HTH...

Jim Thomlinson


"Karen" wrote:

I have a macro that will copy one worksheet to a new one. My user wants
parts of the first worksheet protected (locked cells). When I try to run the
macro, it returns an error due to the protection. How do I write code to
unprotect the current worksheet so I can create a new one - and not have the
user enter the password??

Karen.....

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 447
Default Copying Protected Worksheet

Jin~ That is what I am trying to do within VBA code. I am struggling with
the protect, unprotect, and password codes needed to do this.

Any ideas?

"Jim Thomlinson" wrote:

You can not copy a sheet in code that is protected (the same as you can not
copy it witout using code and just doing it manually). Why not unprotect it,
copy it and reprotect it?
--
HTH...

Jim Thomlinson


"Karen" wrote:

I have a macro that will copy one worksheet to a new one. My user wants
parts of the first worksheet protected (locked cells). When I try to run the
macro, it returns an error due to the protection. How do I write code to
unprotect the current worksheet so I can create a new one - and not have the
user enter the password??

Karen.....

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Copying Protected Worksheet

worksheets("sheet1").unprotect password:="hi"
'do the copy
worksheets("sheet1").protect password:="hi"

If you rightclick on the worksheet tab, you can Move or copy to a new location
(even a different workbook).

This kind of copying will keep the sheet protection.



Karen wrote:

I have a macro that will copy one worksheet to a new one. My user wants
parts of the first worksheet protected (locked cells). When I try to run the
macro, it returns an error due to the protection. How do I write code to
unprotect the current worksheet so I can create a new one - and not have the
user enter the password??

Karen.....


--

Dave Peterson
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
Copying cells in a protected worksheet Rohit Excel Worksheet Functions 2 August 29th 09 07:46 PM
Password protected workbook crashes copying worksheet SueD Excel Discussion (Misc queries) 0 April 21st 08 01:21 PM
Edit text format in non-protected cells in protected worksheet Bonnie Excel Discussion (Misc queries) 2 April 19th 08 04:48 PM
Copying visible cells only on a protected worksheet Paula Excel Discussion (Misc queries) 0 June 6th 06 05:32 PM
Copying a worksheet witrh protected cells to a new worksheet John Excel Worksheet Functions 2 February 1st 06 02:19 PM


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