Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 18
Default Copy paste Macro in a Protected Sheet

Hi Guys!!!

I have a spreedsheet that has a checkbox with a macro and I want to
protect the spreadsheet to protect the formulas from novices users.

I have figure out all the steps of unlock the cell that I want the
user to enter the data, unlocked the cells that link to the check box.
The PROBLEM is that I have a range that a macro has to copy and paste
but I want the range to remain lock for the users but gets unlock when
the macro needs to copy and paste.
this is the code that I have right now:
WHAT DO I NEED TO write to allow the macro to unlock, copy, paste and
lock the file again.

Sub CheckBox1107_Click()
'
' CheckBox1107_Click Macro
'
If ActiveSheet.Range("D19").Value = True Then

Application.Goto Reference:="R16C4"
Range("D16:D18").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("H9").Select
ActiveCell.FormulaR1C1 = "0"
Range("H11").Select
ActiveCell.FormulaR1C1 = "0"
Range("H12").Select
ActiveCell.FormulaR1C1 = "0"
Range("D12").Select
Application.Goto Reference:="R16C4"
Else
Application.Goto Reference:="R45C2"
Range("B43:B45").Select
Range("B45").Activate
Selection.Copy
Application.Goto Reference:="R16C4"
Selection.PasteSpecial Paste:=xlPasteFormulasAndNumberFormats,
Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.Goto Reference:="R16C4"
End If
End Sub


WHAT DO I NEED TO write to allow the macro to unlock, copy, paste and
lock the file again.
Thank YOU,

PAMELA xoxo
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Copy paste Macro in a Protected Sheet


Lock the sheet with a macro instead of manually. When you lock it with a
macro, you can lock it from user input only, but leave other code free
to change things.

For instance, this code locks the sheets when the workbook opens, the
user can't change anything, but your macros could:

=============
Private Sub Workbook_Open()
'If you have different passwords
'for each Worksheet.
Sheets(1).Protect Password:="Secret", _
UserInterFaceOnly:=True

Sheets(2).Protect Password:="Carrot", _
UserInterFaceOnly:=True

'Repeat as needed.
End Sub
===============
Adjust for your needs.


--
JBeaucaire
------------------------------------------------------------------------
JBeaucaire's Profile: http://www.thecodecage.com/forumz/member.php?userid=73
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=48359

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
1 Create a macro to Copy & paste certain data to another sheet Lin1981 Excel Discussion (Misc queries) 1 November 6th 08 11:56 PM
How copy/paste values in Excel doc protected sheet 2 other doc? Got my CWC[_2_] Excel Discussion (Misc queries) 4 October 4th 08 01:28 AM
Do not allow Copy/Paste Functionality in a Protected Sheet Prashanth KR Excel Worksheet Functions 1 October 29th 07 06:12 PM
How to disable copy and paste function in a protected sheet Igneshwara reddy[_2_] Setting up and Configuration of Excel 1 March 17th 07 04:08 AM
How to copy/paste info into the protected sheet Dajana Excel Discussion (Misc queries) 1 September 21st 05 04:26 PM


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