A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

copy & paste from other worksheet - but not allow to cut



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2004, 03:42 PM
external usenet poster
 
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


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.