Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Use VB to unlock & lock cell protection

Hi everyone

was wondering if anyone out there was able to fill in the blanks for me
please.

Using VB

Turn this:

ActiveSheet.Unprotect.
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

into something like this:

Sub()

Application.ScreenUpdating = False

ActiveSheet.Unprotect.Password: = "myPassword"

------ActiveSheet.DoMyThing

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

------DoMyOtherThing

Application.ScreenUpdating = True

End Sub

So the idea here that the user clicks Macro button, it opensTargetWB,
activatesTargetWS, removes cell protections, pastes values, re-applies cell
protection, then closesWB, all within the blink of an eye never knowing that
the cell protection was touched.

Ideas & Suggestions welcomed

TIA
Mick


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Use VB to unlock & lock cell protection

On Feb 14, 9:09*am, "Vacuum Sealed" wrote:
Hi everyone

was wondering if anyone out there was able to fill in the blanks for me
please.

Using VB

Turn this:

ActiveSheet.Unprotect.
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

into something like this:

Sub()

Application.ScreenUpdating = False

ActiveSheet.Unprotect.Password: = "myPassword"

------ActiveSheet.DoMyThing

ActiveSheet.Protect.Password: = *"myPassword", ReConfirm_Password: =
"myPassword", DrawingObjects:=True, Contents:=True, Scenarios:=True

------DoMyOtherThing

Application.ScreenUpdating = True

End Sub

So the idea here that the user clicks Macro button, it opensTargetWB,
activatesTargetWS, removes cell protections, pastes values, re-applies cell
protection, then closesWB, all within the blink of an eye never knowing that
the cell protection was touched.

Ideas & Suggestions welcomed

TIA
Mick


Sub()

Const PW as string="MyPassword"

Application.ScreenUpdating = False

ActiveSheet.Unprotect Password:= PW
------ActiveSheet.DoMyThing

ActiveSheet.Protect Password:= PW, DrawingObjects:=True,
Contents:=True, Scenarios:=True

------DoMyOtherThing

Application.ScreenUpdating = True

End Sub

You may need to take steps such that the password can't be simply
looked up, i.e. protect the code.

A.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Use VB to unlock & lock cell protection

Thx Alan

Appreciate the help

Cheers
Mick


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
Lock Unlock Cell Protection Mike Josephson Excel Worksheet Functions 3 July 17th 09 10:06 PM
hoW TO LOCK AND UNLOCK A CELL USING A FUNCTION/FORMULA Ridhi Excel Worksheet Functions 6 April 23rd 08 05:41 AM
How to lock and unlock a cell using formulas in excel Ridhi Excel Discussion (Misc queries) 1 April 19th 08 11:33 AM
Protection - Allow Group/Ungroup but lock / unlock some cells LinLin Excel Discussion (Misc queries) 2 November 18th 07 10:31 PM
Lock / Unlock Cell Terence Excel Programming 1 September 30th 03 02:44 PM


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