View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.misc
EAHRENS
 
Posts: n/a
Default Need help modifying a macro

Thanks, My concern is only inadvertent modification and I am not using a
password.

It took me a few tries, but I made it create a name and clear the proper
range on the second sheet. Unfortunbately it left the protection off of the
original. I added a line to add it back to the original.. All I need to know
how to do is after it adds the protection back onto the original, how can I
make it then go to the newly copied sheet?

I am now using the following macro:

Sub ICS214()
'
' ICS214 Macro
' Macro recorded 10/5/2005 by Eric Ahrens


'Copy the active worksheet to after the last worksheet
Sheets("ICS 214").Select

Sheets("ICS 214").Copy befo=Sheets(2)
ActiveSheet.Unprotect
'delete constants, retaining formulas in the range "d29-d46"
Range("D29:d46").SpecialCells(xlConstants).ClearCo ntents
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("ICS 214").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
'
End Sub

"David McRitchie" wrote:

Hi Eric,
Yes record a macro, turning off protection using the password, and
turn protection on with the password. The password will be seen by
anyone looking at the macro. Passwords are more to prevent accidents
than theft.

There may be an option that allows you to do things in a macro that
are not allowed to be done manually, but I don't play with passwords.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"EAHRENS" wrote in message ...
Thanks, That helped and got rid of the error message. I thought I was done
and got a new problem. The sheet I am trying to copy is protected. The
range I want to delete is not. The macro won't allow the deletion to occur
if the sheet is protected at all. Is there a way around this? Is is
possible to have the macro turn off the protection, copy and delete and then
turn itself back on? Is there a better way? I really appreciate your help
on this. If it helps, I pasted what I have currently entered below.