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

I have a two page spreadsheet which has limited # of cells for users to input
data, but then need to run a macro to process the data. With the worksheets
protected, the macro will not run. Does anyone know of any workarounds?

Thanks

Steve Eastham
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default how to enable a macro in protected sheet

You really need to be a bit more specific becuase protecting a worksheet
won't stop a macro running but could stop it running as expected. For example
if the macro tried to alter a protected cell an eror would occur.

You could simply un-protect using code as soon as your macro kicked off and
then protect again at the end of the macro.

Sub amacro()
Worksheets("Sheet3").unProtect
'do your stuff
Worksheets("Sheet3").protect
End Sub

Mike

"Steve Eastham" wrote:

I have a two page spreadsheet which has limited # of cells for users to input
data, but then need to run a macro to process the data. With the worksheets
protected, the macro will not run. Does anyone know of any workarounds?

Thanks

Steve Eastham

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 709
Default how to enable a macro in protected sheet

Steve, one way is to let the macro unprotect and protect the sheet,
something like this

Const PW As String = "123" 'Change Password Here

ActiveSheet.Unprotect Password:=PW

'you code here

ActiveSheet.Protect Password:=PW



You will also need to protect the VBA project so you can't see the password
in it.

To protect the VBA project, from your workbook right-click the workbook's
icon and pick View Code. This icon is at the top-left of the spreadsheet
this will open the VBA editor, in Project Explorer right click on your
workbook name, if you don't see it press CTRL + r to open the Project
Explorer then select VBA project properties, protection, check lock project
for viewing and set a password. Press Alt and Q to close this window and go
back to your workbook and save and close the file. Be aware that this
password can be broken by third party software


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003


"Steve Eastham" <Steve wrote in message
...
I have a two page spreadsheet which has limited # of cells for users to
input
data, but then need to run a macro to process the data. With the
worksheets
protected, the macro will not run. Does anyone know of any workarounds?

Thanks

Steve Eastham



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
Enable grouping of rows in a protected sheet Luke Excel Discussion (Misc queries) 0 August 31st 06 06:59 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
How to enable the sort function for a protected sheet lkjing Excel Discussion (Misc queries) 1 June 30th 05 01:18 PM
How do i enable "Group" & "Ungroup" in a protected sheet Fadi Excel Discussion (Misc queries) 1 March 4th 05 05:37 PM
How to enable grouping in a protected sheet Ankur Excel Worksheet Functions 2 November 1st 04 07:52 PM


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