Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macros on protected sheets?


Hi

I have a macro which i need users of the worksheet to run themselves i
order to update the data validation lists.

My sheet is protected so that they cannot mess around with th
formulas.

Is there any way i can run a macro on a protected sheet without puttin
the password in manually?

Any ideas much appreciated

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macros on protected sheets?

Hi Karen

You can unprotect your sheet in the code
and protect it again after your code is ready.

Sheets("Sheet1").Unprotect "ron"
' your code
Sheets("Sheet1").Protect "ron"


But I like this way.

Protect your worksheets with code like this
Place this in the Thisworkbook module.

The macro's will be working now
It will only protect the userfaceonly

Private Sub Workbook_Open()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
sh.Protect userinterfaceonly:=True
Next sh
Application.ScreenUpdating = True
End Sub

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Karen Brown" wrote in message ...

Hi

I have a macro which i need users of the worksheet to run themselves in
order to update the data validation lists.

My sheet is protected so that they cannot mess around with the
formulas.

Is there any way i can run a macro on a protected sheet without putting
the password in manually?

Any ideas much appreciated.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Macros on protected sheets?

Yes, I did it all the time.

'At the beginning of the macro add:
ActiveSheet.Unprotect Password:="yourPassword"

'Then put your code here.

'Then put this at the end of the macro

ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True, Password:="yourPassword"

Be sure to protect the macro or people will be able to see
the password for the sheets

-----Original Message-----

Hi

I have a macro which i need users of the worksheet to run

themselves in
order to update the data validation lists.

My sheet is protected so that they cannot mess around

with the
formulas.

Is there any way i can run a macro on a protected sheet

without putting
the password in manually?

Any ideas much appreciated.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macros on protected sheets?

Try the following:
Sheets("worksheetname").Select
ActiveSheet.Unprotect ("passwordname")

Don't forget to reprotect the worksheet at the end of the
module. This is done by:
ActiveWorksheet.Protect ("passwordname")



-----Original Message-----

Hi

I have a macro which i need users of the worksheet to run

themselves in
order to update the data validation lists.

My sheet is protected so that they cannot mess around

with the
formulas.

Is there any way i can run a macro on a protected sheet

without putting
the password in manually?

Any ideas much appreciated.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from

http://www.ExcelForum.com/

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Macros on protected sheets?

Sometimes, your macro can do things that the user can't--if you protect the
sheet in code:

In a general module:

Option Explicit
Sub auto_open()

With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
End With

End Sub

(that userinterfaceonly stuff is very important to you.)

But there are a few things that can't be done this way. You have to unprotect
and then reprotect.



Karen Brown wrote:

Hi

I have a macro which i need users of the worksheet to run themselves in
order to update the data validation lists.

My sheet is protected so that they cannot mess around with the
formulas.

Is there any way i can run a macro on a protected sheet without putting
the password in manually?

Any ideas much appreciated.

------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/


--

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
run macros on protected sheet widman Excel Discussion (Misc queries) 4 December 10th 06 10:09 AM
control form macros and protected sheets Greyson Excel Discussion (Misc queries) 1 November 4th 06 02:33 AM
Macros with Protected Worksheets Terri Excel Discussion (Misc queries) 1 April 13th 06 06:27 PM
Run macros on protected worksheet paul Excel Worksheet Functions 0 February 4th 06 11:53 AM
Is is possible to run macros on a protected worksheet petunia Excel Worksheet Functions 1 January 18th 05 04:55 PM


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