Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copy & paste worksheet with print settings into new worksheet | Excel Discussion (Misc queries) | |||
allow me to copy and paste in a protected worksheet | New Users to Excel | |||
copy/Paste references other worksheet | Excel Worksheet Functions | |||
excel 97: copy and paste values from one worksheet to another worksheet | Excel Programming | |||
excel 97: copy and paste values from one worksheet to another worksheet | Excel Programming |