Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Vital: Protecting sheets so macros/buttons still work?

This is a big one, it's become extremely vital. Over last 3 weeks I have
done a lot of work writing up several workbooks that contain numerous
buttons with macros assigned to them. One false step or accidental delete
and those buttons are gone! But when I protect the sheet, all the buttons
return error codes.

Can someone pls direct me to a webpage tutorial that explains how to protect
sheets so that the buttons will still work? I understand how to lock cells
and such, that I've been doing for years, it's protecting the sheet as per
normal but allowing the buttons full functionality.

Thank you!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Vital: Protecting sheets so macros/buttons still work?

Hi

do you mean that when you press the button it returns an error as you're
trying to do something you can't do when the sheet is protected? if so how
about incorporating in your macros the unprotecting of the sheet at the
start & the reprotecting of the sheet at the end of the macro?

Cheers
JulieD


"StargateFanFromWork" wrote in message
...
This is a big one, it's become extremely vital. Over last 3 weeks I have
done a lot of work writing up several workbooks that contain numerous
buttons with macros assigned to them. One false step or accidental delete
and those buttons are gone! But when I protect the sheet, all the buttons
return error codes.

Can someone pls direct me to a webpage tutorial that explains how to

protect
sheets so that the buttons will still work? I understand how to lock

cells
and such, that I've been doing for years, it's protecting the sheet as per
normal but allowing the buttons full functionality.

Thank you!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 492
Default Vital: Protecting sheets so macros/buttons still work?

What are the error codes? Protecting a sheet shouldn't affect the execution
of a macro It may be as simple as the buttons attempting to alter the value
of a protected cell.
Regards,
"StargateFanFromWork" wrote in message
...
This is a big one, it's become extremely vital. Over last 3 weeks I have
done a lot of work writing up several workbooks that contain numerous
buttons with macros assigned to them. One false step or accidental delete
and those buttons are gone! But when I protect the sheet, all the buttons
return error codes.

Can someone pls direct me to a webpage tutorial that explains how to

protect
sheets so that the buttons will still work? I understand how to lock

cells
and such, that I've been doing for years, it's protecting the sheet as per
normal but allowing the buttons full functionality.

Thank you!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 492
Default Vital: Protecting sheets so macros/buttons still work?

Sorry, hit Send prematurely!
Try wrapping your code in

Sheets("Sheet1").Unprotect ("YourPassword")
Your Code
Sheets("Sheet1").Protect ("YourPassword")

Regards,
"StargateFanFromWork" wrote in message
...
This is a big one, it's become extremely vital. Over last 3 weeks I have
done a lot of work writing up several workbooks that contain numerous
buttons with macros assigned to them. One false step or accidental delete
and those buttons are gone! But when I protect the sheet, all the buttons
return error codes.

Can someone pls direct me to a webpage tutorial that explains how to

protect
sheets so that the buttons will still work? I understand how to lock

cells
and such, that I've been doing for years, it's protecting the sheet as per
normal but allowing the buttons full functionality.

Thank you!




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Vital: Protecting sheets so macros/buttons still work?

On Wed, 30 Jun 2004 10:38:24 -0400, "StargateFanFromWork"
wrote:

This is a big one, it's become extremely vital. Over last 3 weeks I have
done a lot of work writing up several workbooks that contain numerous
buttons with macros assigned to them. One false step or accidental delete
and those buttons are gone! But when I protect the sheet, all the buttons
return error codes.

Can someone pls direct me to a webpage tutorial that explains how to protect
sheets so that the buttons will still work? I understand how to lock cells
and such, that I've been doing for years, it's protecting the sheet as per
normal but allowing the buttons full functionality.

Thank you!


Thank you so much to Dave Peterson who gave code that worked great in
my test file here at home. Here is the syntax, the only thing that
needs modifying is the macro name and the code one puts in that the
macro deals with, of course <g:

Sub MacroName()
'
With ActiveSheet
.Unprotect
(code goes here)
End With
End Sub



The above allowed me to apply _one_ unprotect/protect lines of code to
the macros regardless of sheet names. So in this test file, where I
had 10 sheets, 2 macros did the job! If I had not had a generic type
of code - in other examples where the sheet name had to be entered, in
other words - 20 different macros would have been required! Not a
pleasant prospect.

Thank you so much to Dave for this! This was the last major hurdle
<crossing fingers to fix on all the workbooks. The remaining two
weeks will allow me to test the files fully as I continue doing my job
which requires using these files on a daily basis.

Cheers!

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Vital: Protecting sheets so macros/buttons still work?

On Sat, 03 Jul 2004 00:13:23 -0400, StargateFan
wrote:

On Wed, 30 Jun 2004 10:38:24 -0400, "StargateFanFromWork"
wrote:



[snip]

Sub MacroName()
'
With ActiveSheet
.Unprotect
(code goes here)
End With
End Sub


WOOPS, missing line. The code above s/b:





Sub MacroName()
'
'
With ActiveSheet
.Unprotect
(code goes here)
.Protect
End With
End Sub





Sorry about that! I accidentally deleted the ".Protect" line when
modifying existing code to get the above to share with the group.
Glad I noticed it, though. <g

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
protecting all but command buttons Monish Excel Discussion (Misc queries) 0 August 6th 07 03:52 PM
Protecting My Macros Greegan Excel Worksheet Functions 1 December 4th 04 10:58 PM
Protecting Macros -is it possible AlwaysAsking Excel Programming 3 June 25th 04 10:55 PM
Macros assigned to buttons do not work when copied to CD Bill Cockerill Excel Programming 2 February 20th 04 12:33 PM


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