ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What of these commands ruin my copy - paste operation between workbooks? (https://www.excelbanter.com/excel-programming/297052-what-these-commands-ruin-my-copy-paste-operation-between-workbooks.html)

No Name

What of these commands ruin my copy - paste operation between workbooks?
 
When I copy a cell in one workbook and want to paste it in an other, I
can't. I suspect one of these commands ruin the operation - any suggestions?

Worksheet_Activate()
ActiveSheet.Unprotect
ActiveSheet.Protect AllowFormattingCells:=False
ActiveSheet.EnableSelection = xlUnlockedCells


Mindkiller No 2
I try to keep the format i one column, despite past operations. Conditional
formatting should be the solution, but I don't succeed. I have a little
extra moment - It sholud be one format when the cell in the column to the
left has a "K" as value, and an other format if it contains value "I".

AND it should keep these formats when copy - paste beteween workbooks.

Any sugestions?

/Regards



Jim Rech

What of these commands ruin my copy - paste operation between workbooks?
 
As to the copying problem, when you do a Copy, Excel is in "code mode".
However a great many actions take Excel out of copy mode, including
apparently some of the ones in your macro. So you should do these actions
before you do the actual copy. Ideally the copy should be followed
immediately by a paste, however you should be able to switch to another
workbook/sheet active before you paste without exiting copy mode.

--
Jim Rech
Excel MVP
wrote in message
...
| When I copy a cell in one workbook and want to paste it in an other, I
| can't. I suspect one of these commands ruin the operation - any
suggestions?
|
| Worksheet_Activate()
| ActiveSheet.Unprotect
| ActiveSheet.Protect AllowFormattingCells:=False
| ActiveSheet.EnableSelection = xlUnlockedCells
|
|
| Mindkiller No 2
| I try to keep the format i one column, despite past operations.
Conditional
| formatting should be the solution, but I don't succeed. I have a little
| extra moment - It sholud be one format when the cell in the column to the
| left has a "K" as value, and an other format if it contains value "I".
|
| AND it should keep these formats when copy - paste beteween workbooks.
|
| Any sugestions?
|
| /Regards
|
|



Dave Peterson[_3_]

What of these commands ruin my copy - paste operation betweenworkbooks?
 
Maybe this'll give you an idea for #2:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

Dim myFormulas As Variant
Dim myRng As Range

Set myRng = Me.Range("b:b")

If Intersect(myRng, Target) Is Nothing Then Exit Sub

myFormulas = Target.Formula 'save the formulas
With Application
.EnableEvents = False
.Undo 'put them back to what they were!
End With
If Union(myRng, Target).Address < myRng.Address Then
MsgBox "Column B cannot be changed with any other column!"
ElseIf Target.Areas.Count 1 Then
MsgBox "Please just one area at a time!"
Else
Target.Formula = myFormulas 'just put the formulas back
End If

errHandler:
Application.EnableEvents = True

End Sub



wrote:

When I copy a cell in one workbook and want to paste it in an other, I
can't. I suspect one of these commands ruin the operation - any suggestions?

Worksheet_Activate()
ActiveSheet.Unprotect
ActiveSheet.Protect AllowFormattingCells:=False
ActiveSheet.EnableSelection = xlUnlockedCells

Mindkiller No 2
I try to keep the format i one column, despite past operations. Conditional
formatting should be the solution, but I don't succeed. I have a little
extra moment - It sholud be one format when the cell in the column to the
left has a "K" as value, and an other format if it contains value "I".

AND it should keep these formats when copy - paste beteween workbooks.

Any sugestions?

/Regards


--

Dave Peterson



All times are GMT +1. The time now is 05:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com