Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Member
 
Posts: 84
Default Macro functions in a protected sheet

How can you have your macros run in a protected sheet? Also, I need to be able to insert comments. Any ideas anyone?

K
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 703
Default Macro functions in a protected sheet

Hi

Your macro can unprotect the sheet, do what you need and protect the
sheet again.

Sub Test()
Sheeets("Sheet1
With Sheets("Sheet1")
.Unprotect Password:="JustMe"
.Range("A1").AddComment ("Merry Christmas")
.Range("B1")="Hello"
.Protect Password:="JustMe"
End With
End Sub

Hopes this helps.
.....
Per


On 8 Dec., 02:09, Keyrookie wrote:
How can you have your macros run in a protected sheet? *Also, I need to
be able to insert comments. *Any ideas anyone?

K

--
Keyrookie


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default Macro functions in a protected sheet

Depends upon what the macro is doing.

Most times you add lines to unprotect...do your stuff.....re-protect.

To insert Comments, when you protect the sheet make sure you allow "edit
objects"


Gord Dibben MS Excel MVP

On Tue, 8 Dec 2009 01:09:10 +0000, Keyrookie
wrote:


How can you have your macros run in a protected sheet? Also, I need to
be able to insert comments. Any ideas anyone?

K


  #4   Report Post  
Member
 
Posts: 84
Default

Thanks for the replies. Is there anyway to "allow edit" ONLY a range of cells? There are other cells I would like to disallow edit. Also, the macro is performing a "paste special" option to replace a formula. The cell that contains the formula I would like to protect to keep from accidental overwrites.

I hope that clarifies. K

Quote:
Originally Posted by Gord Dibben View Post
Depends upon what the macro is doing.

Most times you add lines to unprotect...do your stuff.....re-protect.

To insert Comments, when you protect the sheet make sure you allow "edit
objects"


Gord Dibben MS Excel MVP

On Tue, 8 Dec 2009 01:09:10 +0000, Keyrookie
wrote:


How can you have your macros run in a protected sheet? Also, I need to
be able to insert comments. Any ideas anyone?

K
  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default Macro functions in a protected sheet

By default all cells on a sheet are locked when you protect the sheet.

Best is to select all cells by CTRL + a and unlock all.

Then select those cells which you want locked and set them to locked.

Now protect the sheet. Users can edit unlocked cells.

See options for allowables when go to ToolsProtect Sheet

If you want to edit a locked cell via macro, you must add code to unprotect,
do the stuff, then re-protect.

Sub pasteit()

Activesheet.unprotect password:="mypassword"

code to do things

Activesheet.protect password:="mypassword"

End Sub


Gord

On Wed, 9 Dec 2009 04:10:20 +0000, Keyrookie
wrote:


Thanks for the replies. Is there anyway to "allow edit" ONLY a range of
cells? There are other cells I would like to disallow edit. Also, the
macro is performing a "paste special" option to replace a formula. The
cell that contains the formula I would like to protect to keep from
accidental overwrites.

I hope that clarifies. K

Gord Dibben;907914 Wrote:
Depends upon what the macro is doing.

Most times you add lines to unprotect...do your stuff.....re-protect.

To insert Comments, when you protect the sheet make sure you allow
"edit
objects"


Gord Dibben MS Excel MVP

On Tue, 8 Dec 2009 01:09:10 +0000, Keyrookie
wrote:
-

How can you have your macros run in a protected sheet? Also, I need

to
be able to insert comments. Any ideas anyone?

K-


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 functions in a protected sheet Keyrookie Excel Worksheet Functions 0 December 8th 09 12:01 AM
macro for sorting in protected sheet vcff Excel Discussion (Misc queries) 16 October 22nd 07 03:04 PM
Macro Error when Sheet is Protected Johnny Excel Discussion (Misc queries) 4 July 28th 06 07:43 PM
use macro button to run macro in protected sheet earl Excel Discussion (Misc queries) 3 February 26th 06 10:21 PM
How can you create a macro on a protected sheet? Felix Excel Discussion (Misc queries) 2 February 23rd 06 12:37 AM


All times are GMT +1. The time now is 09:36 PM.

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"