LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default PasteSpecial

I have a protected worksheet which users can enter data into the unprotected
areas. To try to prevent these areas becoming corrupted by formats being
copied in from other worksheets, I have added the following deactivate change
event to datasheet (tried at first to use a cell change event, but it
became too complex):

Private Sub Worksheet_Deactivate()
Dim mynewSheet As String

Application.EnableEvents = False
Application.ScreenUpdating = False
mynewSheet = ActiveSheet.Name

Worksheets("formatsheet").Activate very hidden copy of datasheet formats
Application.Goto reference:="entiresheet"
Selection.Copy
Worksheets("datasheet").Activate
ActiveSheet.Unprotect
Range("a1").Select
Selection.PasteSpecial Paste:=xlPasteFormats
Range("a1").Select
ActiveSheet.Protect DrawingObjects:=True

Worksheets(mynewSheet).Activate

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

This works fine when datasheet is unprotected and without the
Activesheet.Unprotect/Protect statements, but the PasteSpecial fails when the
sheet is protected and with these statements included as above. Can anyone
tell me why?

 
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
Pastespecial and cut Ron[_23_] Excel Programming 4 April 26th 04 02:14 AM
pastespecial Claude Excel Programming 2 February 24th 04 01:21 PM
pastespecial in vba cornishbloke[_13_] Excel Programming 7 December 31st 03 01:02 PM
vba pastespecial joao Excel Programming 2 November 14th 03 03:31 PM
pastespecial billQ Excel Programming 2 July 29th 03 11:39 PM


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