Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default run macro on Protectied sheet

hello,
can we run a macro on proteicted sheet if so how ?
thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default run macro on Protectied sheet

Sure.

But some of the features you try to use may not be available on a protected
worksheet.

A typical solution is to unprotect the worksheet, run the real code and the
reprotect the worksheet.

Option Explicit
Sub Testme01()
dim myPWD as string
myPWD = "top secret"

worksheets("sheet9999").unprotect password:=mypwd

'do the real work

worksheets("sheet9999").protect password:=mypwd
end sub



Tufail wrote:

hello,
can we run a macro on proteicted sheet if so how ?
thanks in advance.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 492
Default run macro on Protectied sheet

Yes you can, use this code to 'sandwich' your code which will unprotect the
sheet for the your code to run, then re-protect it when done, the password
is optional,

Sheet1.Unprotect ("password")
'Your code here
Sheet1.Protect ("password")

Regards,
Alan.
"Tufail" wrote in message
...
hello,
can we run a macro on proteicted sheet if so how ?
thanks in advance.



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default run macro on Protectied sheet

Depends what you want your macro to do but common method is to unprotect the
sheet, do the deed then reprotect.

Sub YourSub()
ActiveSheet.Unprotect Password:="justme"
'your code to do the deed
ActiveSheet.Protect Password:="justme"
End Sub


Gord Dibben MS Excel MVP


On Wed, 3 Jan 2007 15:54:00 -0800, Tufail
wrote:

hello,
can we run a macro on proteicted sheet if so how ?
thanks in advance.


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
Add a Sheet From a Previous Sheet Macro Don Excel Worksheet Functions 3 November 10th 06 11:41 PM
hyperlinks - macro not working to take them off the sheet Lorelei New Users to Excel 1 September 23rd 06 02:18 AM
HELP!! Unhide Sheet with Macro and focus on other sheet [email protected] Excel Discussion (Misc queries) 2 May 23rd 06 07:17 PM
Asked previously...can this not be done in excel simonsmith Excel Discussion (Misc queries) 2 May 16th 06 11:50 PM
Finding and compiling list of cells containing data... Richard Walker Excel Worksheet Functions 6 March 18th 06 02:17 PM


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