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

Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default run macros on a protected sheet?

Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default run macros on a protected sheet?

Chip -- That's what I suspected. Thanks very much for
confirming. Joe

-----Original Message-----
Joe,

If the procedure changes cells, you must unprotect the

sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in

message
...
Is it possible to run a macro on a protected sheet?

I've
tried and tried but I can't figure it out. Thanks.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default run macros on a protected sheet?

Unprotecting is certainly the most robust approach, but you can do most
things with the sheet still protected using the
UserInterfaceOnly
only property of the the Protect method which must be set using VBA. In
xl2000 and xl97, you can set this without providing the password. In later
versions, I believe you have to provide the password.


Activesheet.Protect UserInterfaceOnly:=True

Must be done each time the workbook is opened as the setting is not retained
across the closing and opening of the workbook (so use the Workbook_Open
event).

--
Regards,
Tom Ogilvy

"Joe Z" wrote in message
...
Chip -- That's what I suspected. Thanks very much for
confirming. Joe

-----Original Message-----
Joe,

If the procedure changes cells, you must unprotect the

sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in

message
...
Is it possible to run a macro on a protected sheet?

I've
tried and tried but I can't figure it out. Thanks.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default run macros on a protected sheet?

Chip,
My additional question is: Are you sure that one cannot unprotect sheet
whitin a macro, make changes to cells, protect the sheet again and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default run macros on a protected sheet?

Chip didn't say you couldn't - he said that would be the way to do it.
Although I have suggested an additional method as well.

--
Regards,
Tom Ogilvy

"Martyn" wrote in message
...
Chip,
My additional question is: Are you sure that one cannot unprotect sheet
whitin a macro, make changes to cells, protect the sheet again and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default run macros on a protected sheet?

I reread his response and see the confusion - he meant that the sheet must
be unprotected before changes to the cell were made - his answer could be
misconstrued to seem he said it had to be done in a separate macro - but
that is not the case.

--
Regards,
Tom Ogilvy

"Martyn" wrote in message
...
Chip,
My additional question is: Are you sure that one cannot unprotect sheet
whitin a macro, make changes to cells, protect the sheet again and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.











  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default run macros on a protected sheet?

Martyn,

You can certainly unprotect the sheet within the procedure, and
then protect it at the end. E.g.,

Worksheets("Sheet1").Unprotect 'password:="whatever"
' your code here
Worksheets("Sheet1").Protect 'password:="whatever"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Martyn" wrote in message
...
Chip,
My additional question is: Are you sure that one cannot

unprotect sheet
whitin a macro, make changes to cells, protect the sheet again

and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in

message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default run macros on a protected sheet?

I' am glad that I underestood the same...
Thanks to Tom as well. AFAIK he is among the best around here...and I love
keep following his answers.


"Chip Pearson" wrote in message
...
Martyn,

You can certainly unprotect the sheet within the procedure, and
then protect it at the end. E.g.,

Worksheets("Sheet1").Unprotect 'password:="whatever"
' your code here
Worksheets("Sheet1").Protect 'password:="whatever"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Martyn" wrote in message
...
Chip,
My additional question is: Are you sure that one cannot

unprotect sheet
whitin a macro, make changes to cells, protect the sheet again

and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in

message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.












  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default run macros on a protected sheet?

Chip,

Excel documentation speaks of
Worksheets("Sheet1").Protect 'password:="whatever" UserInterfaceOnly:= true
which should protect the sheet but allow the running of macros.
But it does not seem to work well with excel 2000 ; several actions by
macros seems to be still forbidden with this "userinterfaceonly" protection.

Truly yours,

René.


"Chip Pearson" a écrit dans le message de
...
Martyn,

You can certainly unprotect the sheet within the procedure, and
then protect it at the end. E.g.,

Worksheets("Sheet1").Unprotect 'password:="whatever"
' your code here
Worksheets("Sheet1").Protect 'password:="whatever"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Martyn" wrote in message
...
Chip,
My additional question is: Are you sure that one cannot

unprotect sheet
whitin a macro, make changes to cells, protect the sheet again

and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in

message
...
Is it possible to run a macro on a protected sheet? I've
tried and tried but I can't figure it out. Thanks.














  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default run macros on a protected sheet?

Rene,

Using the UserInterfaceOnly flag should permit any VBA code to
modify the worksheet. Can you provide a specific example is this
not being the case? I've never run across a situation in which it
doesn't work as described.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"rene" wrote in message
...
Chip,

Excel documentation speaks of
Worksheets("Sheet1").Protect 'password:="whatever"

UserInterfaceOnly:= true
which should protect the sheet but allow the running of macros.
But it does not seem to work well with excel 2000 ; several

actions by
macros seems to be still forbidden with this

"userinterfaceonly" protection.

Truly yours,

René.


"Chip Pearson" a écrit dans le message de
...
Martyn,

You can certainly unprotect the sheet within the procedure,

and
then protect it at the end. E.g.,

Worksheets("Sheet1").Unprotect 'password:="whatever"
' your code here
Worksheets("Sheet1").Protect 'password:="whatever"



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Martyn" wrote in message
...
Chip,
My additional question is: Are you sure that one cannot

unprotect sheet
whitin a macro, make changes to cells, protect the sheet

again
and exit?
I'll be much obliged if you or anyone else could answer.

"Chip Pearson" wrote in message
...
Joe,

If the procedure changes cells, you must unprotect the

sheet
prior to executing the macro.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Joe Z" wrote in

message
...
Is it possible to run a macro on a protected sheet?

I've
tried and tried but I can't figure it out. Thanks.














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
protecting macros for a protected sheet Jon Excel Discussion (Misc queries) 3 March 29th 06 03:32 PM
Run macros on protected worksheet Lisa D'K Excel Worksheet Functions 0 February 4th 06 08:06 PM
Enabling macros while the sheet being protected ! dinesh Excel Discussion (Misc queries) 13 September 27th 05 08:47 PM
is it possible to use macros when the sheet is protected Dajana Excel Discussion (Misc queries) 1 September 23rd 05 03:08 AM


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