Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default copy & paste from other worksheet - but not allow to cut

I have a formatted area I try to keep right formatted! I have tried to use
conditional formatting, but when you paste a cell from an other worksheet,
that format follow.

I have tried to use the frequent suggested funktion DisableCutAndPaste
below, but it doesn't allow me to copy & paste! I tried to disable some of
the controls, but can't find it to work. Please help me! I enclose the whole
code for the specific sheet (Blad101) if there are any of the other subs who
cause any trouble.

Thank you for any help!


Private Sub Worksheet_Activate()
ActiveSheet.Unprotect
Call DisableCutAndPaste

If Blad101.Range("O13") = 1 Then
Call GomTommaRader_B_4_125 ' hide rows sub if
checkbox = 1

ElseIf Blad101.Range("O13") = 0 Then
Call TaFramRad_Alla 'unhide rows
if checkbox = 0
End If

ActiveSheet.Protect AllowFormattingCells:=False
ActiveSheet.EnableSelection = xlUnlockedCells


End Sub
Private Sub Worksheet_Deactivate()
Call EnableCutAndPaste

End Sub

Sub DisableCutAndPaste()
EnableControl 21, False ' cut
'EnableControl 19, False ' copy
'EnableControl 22, False ' paste
'EnableControl 755, False ' pastespecial
'Application.OnKey "^c", ""
'Application.OnKey "^v", ""
'Application.OnKey "+{DEL}", ""
'Application.OnKey "+{INSERT}", ""
Application.CellDragAndDrop = False
End Sub

Sub EnableCutAndPaste()
EnableControl 21, True ' cut
EnableControl 19, True ' copy
EnableControl 22, True ' paste
EnableControl 755, True ' pastespecial
Application.OnKey "^c"
Application.OnKey "^v"
Application.OnKey "+{DEL}"
Application.OnKey "+{INSERT}"
Application.CellDragAndDrop = True
End Sub

Sub EnableControl(Id As Integer, Enabled As Boolean)
Dim CB As CommandBar
Dim C As CommandBarControl
For Each CB In Application.CommandBars
Set C = CB.FindControl(Id:=Id, recursive:=True)
If Not C Is Nothing Then C.Enabled = Enabled
Next
End Sub



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
copy & paste worksheet with print settings into new worksheet Larry Ohio Excel Discussion (Misc queries) 1 December 23rd 09 05:17 PM
allow me to copy and paste in a protected worksheet George New Users to Excel 3 August 13th 06 08:11 PM
copy/Paste references other worksheet Ivano Excel Worksheet Functions 4 April 1st 06 01:06 AM
excel 97: copy and paste values from one worksheet to another worksheet JMCN Excel Programming 2 September 23rd 03 01:32 PM
excel 97: copy and paste values from one worksheet to another worksheet Kathy[_5_] Excel Programming 0 September 21st 03 03:03 PM


All times are GMT +1. The time now is 08:03 PM.

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"